Disable validation when cancel button is clicked

You have put a validation on an ASP.NET page. The trouble is if you hit cancel, the validation control stills take effect. This can be cumberson because you are just canceling an action. The easy cure is put the following attributes in the cancel button

<asp:Button id="Button1" runat="server"
  Text="Cancel" CausesValidation="False">
</asp:Button>

This should fix it. When you click Cancel button, validation will not take place.

This entry was posted in Software Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s