Sunday, April 22, 2012

ASP.NET bypassing validation on Cancel button

If we have a form with required field validations, how do we add a "Cancel" control without having our validation controls get triggered? 
Very simple: we need to set the CauseValidation parameter to False. That's it.

<asp:LinkButton ID="lnkbtn_cancel_form" runat="server" Text="Cancel" CausesValidation="False"></asp:LinkButton>

Enjoy!

No comments:

Post a Comment