I:
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 validationgroup for another button. <Asp: button id = "buttonok" runat = "server" text = "quit" onclick = "exit_click"/> |
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 validationgroup for another button. <Asp: button id = "buttonok" runat = "server" text = "quit" onclick = "exit_click"/> |
II:
There are multiple verification controls on a page and verification issues after the control is submitted.
For example, there are two input boxes: T1: val1 (corresponding verification control)
T2: val2 (corresponding verification control)
And two buttons: Bt1 and bt2. Bt1 corresponds to T1 and bt2 corresponds to T2.
After you click submit, the system will verify the request first. In this case, the process is as follows:
Attributes of the two verification controls: enabled = "false" enableclientscript = "false"
When you click Bt1, the corresponding event handler is written as follows:
Val2.enabled = false;
Val1: enabled = true;
Page. Validate ();
If (page. isvalid)
{
........
}
Similarly, bt2 corresponds:
Val1.enabled = false;
Val2.enabled = true;
Page. Validate ();
If (page. isvalid)
{
......
}