Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: onclick event - js and ASP.NET
12-07-2009, 08:59 PM #1
- Join Date
- Dec 2009
- Thanked 0 Times in 0 Posts
onclick event - js and ASP.NET
var res=window.confirm("Please confirm cancellation-text boxes will be cleared");
Is this code valid or invalid for the events I need? How do I set it to fire when user clicks the ASP Cancel button?
12-07-2009, 09:25 PM #2
Easy answer is to *NOT* use an <asp:button> for Cancel.
Just use ordinary HTML button:
And then, yes, I think your JS code for Clear() looks right.Code:<input type="button" value="Cancel" onClick="Clear( )" />
But are you sure those are the right ID's for those text boxes??? I think ASP.NET munges the ID you give in the ASP.NET form to give you a different client-side ID.
To find out, bring up the page in your browser and then do a VIEW==>>SOURCE to look at the HTML ASP.NET is generating. Verify the ID's of those fields.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.