Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I disable a RequiredFieldValidator 1

Status
Not open for further replies.

arneweise77

Programmer
Apr 25, 2002
46
SE
Hi everyone. I´m struggling with a RequiredFieldValidator. I want to disable it when pressing one button, and have it enabled when pressing another button. But somehow "validator-id.enabled = false/true" doesn´t work. Is there some other way to go around this?
Hope someone can solve this for me, and thanks in advance if so.

Take care, Arne
 
Arne

You can change the 'causesvalidation' property of the button to stop all validators on the page. this can be an attribute of the button tag and is just set to true/fasle.

If you want just some of the validators on the page to run when the button is pressed then set causesvalidation to false and then on pressing the button in your code behind you can run and test the required validators something like...
Code:
validatorid.validate();
if(validatorid.isValid) //action

hope this helps

Rob

------------------------------------

On with the dance! let joy be unconfined;
No sleep till morn, when Youth and Pleasure meet
To chase the glowing hours with flying feet.
-Byron

------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top