ASP.NET 2.0 button click to perform 2 actions (client side e-mail then redirect to another page)
-
I have a button click and what I need to do is too things: 1. Send an email to the value of what was selected from a required dropdown list of people 2. Then send the user to another page. I wanted to do both of these in the code behind, and it's been decided the application owner (person who's funding the application) would like to use the client's email application (ie. Eudora, Outlook, etc.) when sending this email. I'm not sure how to replicate the href='mailto:person@person.com' that's possible with the anchor tag.
-
I have a button click and what I need to do is too things: 1. Send an email to the value of what was selected from a required dropdown list of people 2. Then send the user to another page. I wanted to do both of these in the code behind, and it's been decided the application owner (person who's funding the application) would like to use the client's email application (ie. Eudora, Outlook, etc.) when sending this email. I'm not sure how to replicate the href='mailto:person@person.com' that's possible with the anchor tag.
What you may consider doing is adding a client-side click handler that opens the
mailto
link in a new window. So long as you don't returnfalse
from the client event, then your server-sideClick
event will still fire so that you can call your redirect there. For example:<asp:Button ID = "test"
OnClick = "Button_Click"
OnClientClick = "window.open('mailto:user@server.ext'); return true;"
Text = "Click Me"
runat = "server"/>
Hope that helps. :)
--Jesse
-
What you may consider doing is adding a client-side click handler that opens the
mailto
link in a new window. So long as you don't returnfalse
from the client event, then your server-sideClick
event will still fire so that you can call your redirect there. For example:<asp:Button ID = "test"
OnClick = "Button_Click"
OnClientClick = "window.open('mailto:user@server.ext'); return true;"
Text = "Click Me"
runat = "server"/>
Hope that helps. :)
--Jesse
Wonderful