473,529 Members | 2,756 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 18935
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
2833
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 data from the button is not available at this time as to allow the table to properly update. So basically, I need to call UpdateTable() twice, once...
4
4012
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 ontop of the webform1: Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code "
11
10988
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 for the current button and then run this code, if the ".DialogResult" property is change, it does not take affect until the button is pressed again....
3
4258
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 - A TextBox for the Password - A Button labelled "Submit" If the user enters a correct username/password combination then he's taken to another...
17
9625
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 event. But if I press the button without entering text first, the button click event does work. What's up? <html> <body> <h3>Events on Buttons and...
0
2024
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 code behind side. I have a button and text box Button Id: btnSearch TextBox id: txtSearch
7
6848
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, it is not work, anyone can tell how to use button click event ? Thanks in advance, Martin
3
21056
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 button click event in perl And I have to copy/cut that Enable checkbox Data to the Other Folder in the SystemAnywhere.
0
7353
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7273
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7514
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7262
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7624
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1727
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 we have to send another system
0
568
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.