Link: http://www.cnblogs.com/hakuci/archive/2008/08/01/1153007.html
Problem description: create multiple buttons on a page. By default, the button event conflicts with the data verification control: when one of the buttons is clicked, you want a specific validator to be fired, instead of all validator on the page. Validator is not required for other buttons. The data verification control is enabled.
Note: There is no better way except the hack code in ASP. NET 1.1. In ASP. NET 2.0, the validator group attribute is added to all validator controls and buttons (such as buttons and linkbuttons) to easily solve this problem. If there is a textbox in the page and there is a requiredfieldvalidator and button control next to it, you can set the validationgroup attributes of requiredfieldvalidator and button to the same value so that only the validator of requiredfieldvalidator is triggered when you click button. Any other validator that is not defined in the validationgroup will be ignored.
Example:
Text Box and data verification controls:
<Asp: textbox id = "txtoldps" runat = "server" width = "150px"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "requiredfieldvalidator1" runat = "server" controltovalidate = "txtoldps"
Display = "NONE" errormessage = "<B> reminder </B> <br/> enter the original password !! "Validationgroup = "validatagroup1"> </ASP: requiredfieldvalidator>
Button event:
<Asp: button id = "buttonok" runat = "server" text = "modify" onclick = "edit_click"Validationgroup = "validatagroup1"/>
You do not need to set another buttonValidationgroup
<Asp: button id = "buttonok" runat = "server" text = "quit" onclick = "exit_click"/>