Validatorcalloutextender this control is used to extend the verification control and to style and emphasize error prompts of the verification control.
Here is an example:
1) Create an ASP. NET Ajax-enabled web project in vs2005 and name it validatorcalloutextender1.
2) drag and drop two textbox on the page to enter the user name and phone number. Add requiredfieldvalidator to the textbox of the input username, and add requiredfieldvalidator and regularexpressionvalidator to the textbox of the input phone number. At the same time, each validator is extended with a validatorcalloutextender.
CodeAs follows: 1 < Div >
2 Name: & Nbsp;
3 < ASP: textbox ID = "Txtname" Runat = "Server" > </ ASP: textbox >
4 < ASP: requiredfieldvalidator ID = "Requiredfieldvalidator1" Runat = "Server" Controltovalidate = "Txtname"
5 Display = "NONE" Errormessage = "Name is required" > </ ASP: requiredfieldvalidator >
6 < C0: validatorcalloutextender ID = "Validatorcalloutextender1" Runat = "Server" Targetcontrolid = "Requiredfieldvalidator1" >
7 </ C0: validatorcalloutextender >
8 < BR />
9 < BR />
10 Phone: & Nbsp;
11 < ASP: textbox ID = "Txtphone" Runat = "Server" Ontextchanged = "Textbox2_textchanged" > </ ASP: textbox >
12 < ASP: requiredfieldvalidator ID = "Requiredfieldvalidator2" Runat = "Server" Controltovalidate = "Txtphone"
13 Display = "NONE" Errormessage = "Phone is required" > </ ASP: requiredfieldvalidator >
14 < ASP: regularexpressionvalidator ID = "Regularexpressionvalidator1" Runat = "Server" Controltovalidate = "Txtphone"
15 Display = "NONE" Errormessage = "Regularexpressionvalidator" Validationexpression = "(\ D {3} \) | \ D {3 }-)? \ D {8 }" > </ ASP: regularexpressionvalidator >
16 < C0: validatorcalloutextender ID = "Validatorcalloutextender2" Runat = "Server" Targetcontrolid = "Requiredfieldvalidator2" >
17 </ C0: validatorcalloutextender >
18 < C0: validatorcalloutextender ID = "Validatorcalloutextender3" Runat = "Server" Targetcontrolid = "Regularexpressionvalidator1" >
19 </ C0: validatorcalloutextender >
20 < BR />
21 < BR />
22 < ASP: button ID = "Button1" Runat = "Server" Text = "Button" /> </ Div >
3) press Ctrl + F5 to view the effect in the browser.
As follows: