[Resolved] Disabling Validators for asp.net 2.0

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
sp.Net 2.0 / VS 2005 project:
I have a page that contains 3 RangeValidator controls and 2 RequiredFieldValidator controls.

I've been asked to add a "Logout" button that simply redirects the browser to a different page.

In the click event of the button, I set all 5 of the control's Enabled and Visiable properties to False, then a Response.Redirect() call, but it wont redirect the page because of the validation controls.

How do I solve this?
 
Without setting the properties, the validation will occur. This validation is what's blocking the redirect. So I have to disable the validation to move off the page, or set all the controls on the page to values that will satisfy the validation (which is a retarded approach).

Actually the validation has a client side and server side validation. It was the client side validation that's blocking the redirect. I did find out that button's have a CausesValidation True/False property, set it to False and it disables the client side validation for me. I already have the code for disabling the server side. Everything works now.
 
Back
Top