Click here to Skip to main content
12,450,347 members (43,447 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
<input type="text" name="contactFormName" id="name"  onfocus="clearInput(this,'focus','Enter your name')"  önblur="clearInput(this,'blur','Enter your name')"  runat="server" />
 
<input type="text" name="contactFormEmail" id="mail"  onfocus="clearInput(this,'focus','Enter your e-mail')"  önblur="clearInput(this,'blur','Enter your e-mail')"  runat="server" />
												<textarea name="contactFormMessage" id="msg" rows="0" cols="0" onfocus="clearInput(this,'focus','Enter your message')"  runat="server"   önblur="clearInput(this,'blur','Enter your message')"></textarea>
 
<input id="but"  runat="server" name="contactFormSend" onblur="clearInput(this,'blur','Send')"
               onfocus="clearInput(this,'focus','Send')" type="button" value="Send" style="width: 100px"  önserverclick="but_ServerClick">
protected void but_ServerClick(object sender, EventArgs e)
    {
        try {
            string to = "sample@gmail.com";
            MailMessage email = new MailMessage();
            email.To.Add(to);
            MailAddress maFrom = new MailAddress("sample@gmail.com");
            email.From = maFrom;
            
            email.Subject = "Contact Detail";
            email.IsBodyHtml = true;//this is only if you are sending an html message
            email.Body = "<html><body> <font face="\"Cambria\"" size="\"3\""><center><h3>Registration</h3>

Here my button click not captured my input text.. It sends mail as Name: Enter your Name.

Mail as Enter your mail

Can anyone help me?
Posted 8-Jan-13 18:44pm
Updated 8-Jan-13 19:24pm
v3

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

my button click not captured my input text.
How would it? You have written code for exactly what is happening right now. You have set onblur event on the input textboxes. The moment, you press your button, onblur will be called and everything will be reset.

Looks like a copy-paste of onfocus & onblur events without any thought reason or need. To start with, remove the onblur event and see how things go. I would suggest to remove calls of onfocus too that you make on button as that does not make much sense until you need something very specific.
  Permalink  
Comments
Zafar Sultan 9-Jan-13 3:39am
   
*****

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100