newbie question on image button

  • Thread starter Thread starter Danny Ni
  • Start date Start date
D

Danny Ni

Hi,

How do I bring up the email box using <asp:ImageButton> server control? the
following code can do redirect to another aspx file:

private void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect ("default.aspx");
}

But I want to do eamil.

TIA
 
Well you can use mailto in order to get what you want. I am not sure what
your scenario is but, why do not use a simple IMG tag along with an A tag
(it is called anchor) instead of an ASP.NET image control.You can even make
the anchor a server control (adding a runat=server attribute) if u want
achieve almost the same functionality as an ASP.NET image control.

The code would look something like:

<A href='mailto:[email protected]'>
<IMG src='http://www.go.com/static/images/checkmailbutton.gif'
border='0'>
</A>

Hope this helps

Alan Ferrandiz L.
MCDBA, MCT, MSF Practitioner
 
Thank you for the response.
I was asked to use ASP.Net server controls whenever it's possible, a company
policy actually. Some of my coworkers keep saying ASP.Net can not do a lot
of stuff ASP can. Just want to keep myself open minded.
 
Danny,

That's a bad policy. First, ASP.NET can do everything classic asp did plus a
whole lot more. But while it's object oriented structure allows a lot more
to be done it uses more overhead because it can do more. You need to use
server controls responsibly. There is no need to use a server control if the
data it contains is not dynamic. If a link need only be a regular mailto:
link it is a waste of flops to use a server control (or make the link into a
server control with runat="server") unless the email address itself needs to
be dynamic.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Back
Top