View previous topic :: View next topic |
Author |
Message |
Stacy
Joined: 12 Oct 2004 Posts: 9
|
Posted: Mon Nov 08, 2004 10:00 am Post subject: ASP.NET Cancel button is triggering validation |
|
|
I have a form in ASP.NET page, and this form is used for user's registration. I have 2 buttons Submit and Cancel, bot ASP.NET buttons with runat=server attribute. I also have ASP.NET validators controls, validating various fields in my form, and I have enabled the client-side validation. When I click the Submit button, everything works fine, but if I click the Cancel button (it just redirects to the home page) I see the validators error messages and the redirect doesn't work.
How do I tell my ASP.NET not to run the validation, when the Cancel button has been clicked?
I hope this makes sense.
Thanks,
Stacy |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Mon Nov 08, 2004 12:02 pm Post subject: |
|
|
Hey Stacy,
I know what you mean. You need to set the control's CausesValidation property to false, and this way your Cancel button will not not perform a validation check:
Code: |
<asp:Button id="CancelButton" runat="server"
Text="Cancel" CausesValidation="False">
</asp:Button>
|
Cheers, _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|