C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

in asp.net using c# i wants to validate an email id by writing javascript


Posted Date: 03 Nov 2008      Posted By: krishnamurthy      Member Level: Gold     Points: 1   Responses: 4



in asp.net using c# i wants to validate an email id by writing javascript, how to do this. i got some code but all are giving only the javascript function ,i dont know how to call that function in the button click event,please give me the complete coding ,its very urgent.




Responses

Author: Lakshmikanthan V.R    03 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Here are the two easy ways you can workout.

1. For button you can find OnClientClick property in ASP.NET 2.0 add the function name for that property.

2. In page load add the following code
btnName.Attributes.Add("Onclick","functionname();");



Author: Gaurav Agrawal    03 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

<asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="~/images/Submit.gif" OnClick="ImageButton1_Click" ToolTip="Submit" OnClientClick="return validateEmail();" />

GA

Thanks & Regards,

Gaurav Agrawal
Sr.Software Engineer
gaur1982@yahoo.com
09829373514



Author: Miss Meetu Choudhary    03 Nov 2008Member Level: DiamondRating: 3 out of 53 out of 53 out of 5     Points: 3

To achieve the goal you have two ways

1. by setting property
you can set the OnClientClick property either in the source code or in aspx page or by using property bag just set the value to the name of the JavaScript function

2. by dding attribute
i would suggest the page load event for the purpose or you cn use the event of your choice in this you have to add the attribute using the following line of code
btuuon1.Attributes.Add("Onclick","functionname()");


i will suggest to go with the first method

++
Thanks and Regards
Meetu Choudhary

Thanks and Regards
Miss Meetu Choudhary (Site Coordinator)
Go Green Save Green
My Profile on Google



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : in asp.net using c# i wants to validate an email id by writing javascript
Previous : How to get selected date value from popup form to my original form.
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use