| Author: Lakshmikanthan V.R 03 Nov 2008 | Member Level: Silver | Rating:  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 2008 | Member Level: Diamond | Rating:  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 2008 | Member Level: Diamond | Rating:   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
|