Ajax controltoolkit Learning Log-validatorcalloutex.pdf (31)

Source: Internet
Author: User
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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.