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 Mike Lewis 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 bypass a validator when button pressed

Status
Not open for further replies.

Duanw

IS-IT--Management
Dec 5, 2005
7
GB
Hi All

I have an webpage which contains a form. On the form are two buttons. One button will need some input from various asp:textboxes with required field validators. Once clicked, the page posts back to itself, adding a record to the datagrid below it. It has a statement that checks that all fields are completed.

"If Page.IsValid = True Then"

The other button is supposed to just link to the shopping cart, showing the items inside it. But when I click the 'Submit' button, the required field validators do not allow me to continue. This event does not contain the

If Page.IsValid = True Then" statement

How can I bypas the validators when the 'Submit' is pressed.

Thank you all in advance.

D
 
Have a look into ValidationGroup's. They allow you to assign each control to a particular group and therefore allowing your second button to do whatever it needs without triggering the validation that is required for the first button to continue.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks for that. Works perfectly now!!
 
Also on the second button you can simpy set the CausesVailidation = FALSE.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top