Home All Groups Group Topic Archive Search About

How can cancel a validator

Author
7 Mar 2006 4:03 AM
ad
I am use a RequiredFieldValidator to valid a Text box, and there are two
Buttons on the forms,
one for OK and one for Cancel, both are Asp.Net controls.

When a user press Cancel to cancel the input, the RequiredFieldValidator
also require user must enter the value.

How can I do?

Author
7 Mar 2006 12:27 PM
Jonathan
If you're looking for a way to bypass validation when the cancel button
is clicked, take a look at the CausesValidation property on the
System.Web.UI.WebControls.Button class.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsButtonClassCausesValidationTopic.asp

Otherwise, you might be better off posting this question to the
microsoft.public.dotnet.framework.aspnet news group.
Author
7 Mar 2006 11:42 PM
Darren Kopp
Set the CausesValidation property on the cancel button to false

HTH,
Darren Kopp
http://blog.secudocs.com/

AddThis Social Bookmark Button