473,503 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using mailto in a button click event

Not being an web programmer I am unable to figure out how to put the
hyperlink mailto:emailaddress in a button click event. I do not want a
hyperlink on the form. I have found nothing to address this. using
response.redirect is not the answer because you do not return to the page
with the button on it.
Also, is it necessary to encode the address and if yes, how to do that, please

Thanks. I am sure this is very simple but I am a windows programmer not used
to links, html, etc.
--
smHaig
Mar 2 '06 #1
3 18928
That's client-side stuff.
Add an onclick handler to a simple html button, not
a server control, like so: onclick="return OpenMail();"

Then in the javascript on the page, in
client-side script tags, best in the html header:

<script type="text/javascript">
function OpenMail()
{
location.href = "mailto:he**@help.net";
return false;
}
</script>

That should do it.
No encoding should be necessary.

"smHaig" <sm****@discussions.microsoft.com> wrote in message
news:71**********************************@microsof t.com...
Not being an web programmer I am unable to figure out how to put the
hyperlink mailto:emailaddress in a button click event. I do not want a
hyperlink on the form. I have found nothing to address this. using
response.redirect is not the answer because you do not return to the page
with the button on it.
Also, is it necessary to encode the address and if yes, how to do that, please
Thanks. I am sure this is very simple but I am a windows programmer not used to links, html, etc.
--
smHaig


Mar 2 '06 #2
I have used your suggestion which seems clearly the right way, but I have
this error:
handles clause requires withevents qualifier.

where would this go? on the function heading. Or is there a withevents
needed and where would that go?
--
smHaig
"smHaig" wrote:
Not being an web programmer I am unable to figure out how to put the
hyperlink mailto:emailaddress in a button click event. I do not want a
hyperlink on the form. I have found nothing to address this. using
response.redirect is not the answer because you do not return to the page
with the button on it.
Also, is it necessary to encode the address and if yes, how to do that, please

Thanks. I am sure this is very simple but I am a windows programmer not used
to links, html, etc.
--
smHaig

Mar 2 '06 #3
I had spoken to soon. The problem was that I failed to remove the button
click event for the asp button that I removed when I instead used the html
button. Moral of story: the error message may be accurate but difficult to
decipher--
smHaig
"smHaig" wrote:
I have used your suggestion which seems clearly the right way, but I have
this error:
handles clause requires withevents qualifier.

where would this go? on the function heading. Or is there a withevents
needed and where would that go?
--
smHaig
"smHaig" wrote:
Not being an web programmer I am unable to figure out how to put the
hyperlink mailto:emailaddress in a button click event. I do not want a
hyperlink on the form. I have found nothing to address this. using
response.redirect is not the answer because you do not return to the page
with the button on it.
Also, is it necessary to encode the address and if yes, how to do that, please

Thanks. I am sure this is very simple but I am a windows programmer not used
to links, html, etc.
--
smHaig

Mar 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2832
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
4
4009
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
11
10983
by: Sarah | last post by:
I have code that I want to run so that if the result is true, it changes the current button's ".DialogResult" property to "DialogResult.OK". Problem is, when I run this code on the ".Click" event...
3
4253
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username...
17
9618
by: Eric | last post by:
I'm new to JavaScript and I wrote this code to play with. Oddly, if I enter text in a box and then press the button, I only get the onChange event for the text box and not the button's onclick...
0
2022
by: nraji | last post by:
hi, I have designed a web part using VS 2003 (Web control library template). I need to publish that in share point. Its not like drag and drop the things from toolbar. Every thing I need to do in...
7
6844
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
3
21044
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
4
6072
by: talk2mishal | last post by:
Hi, As i m newbie for the Perl With Html Button. The scenario is like this: I have HTML button in the perl Script. I have to get the Data of Enable checkbox Data using the...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.