Conditional RequiredFieldValidator


I'm wondering if it is possible to cause the RequiredFieldValidator to validate ONLY when a specific button is pressed on a form, but none others.  Example:

<form id="form" runat="server">
   <asp:TextBox id="textbox1" runat="server" />
   <asp:RequiredFieldValidator id="vld1" runat="server" ErrorMessage="Required" ControlToValidate="textbox1" /><br />
   <asp:TextBox id="textbox2" runat="server" />
   <asp:RequiredFieldValidator id="vld2" runat="server" ErrorMessage="Required" ControlToValidate="textbox2" />

   <asp:Button id="btnAddRow" Text="Add New Field" onclick="btnAddNewField_Click" />
   <asp:Button id="btnSubmit" Text="Submit" onclick="btnSubmit_Click" />

When the user clicks "Submit", I want the field validators to work (and display the corresponding error message, if necessary).  If the user clicks the "Add New Field" button, I want the form to add a new field, but not display the error messages during postback.  How do I prevent the validator errors from appearing?  Is there a way I can "clear" the IsValid status of the page?  I'd like to avoid using a Response.Redirect if possible, only for cleanliness.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Set the CausesValidation property True for button btnSubmit but False for btnAddRow.

Try this...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hendridmAuthor Commented:
Thanks much!  Worked perfectly.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.