Ajax controltoolkit learning logs-maskededitextender and maskededitvalidator (15)

Source: Internet
Author: User
Maskededitextender is used to specify and modify the content in the text box, so that the user input format can meet the needs directly.
Maskededitvalidator is used to verify the value entered in the text box to meet the requirements.

The following is an example:

1) Create an ASP. NET Ajax-enabled web project in vs2005 and name it maskededitextender1.

2) drag and drop a textbox on the default. aspx page and set the ID to txtdate. Drag and Drop a maskededitextender and set its attributes.

CodeAs follows: : 1 < C0: maskededitextender ID = "Maskededitextender1" Targetcontrolid = "Textbox1" Mask = "99-99-99" Onfocuscssclass = "Maskededitfocus" Oninvalidcssclass = "Maskedediterror" Messagevalidatortip = "True" Masktype = "Date" Runat = "Server" > </ C0: maskededitextender >
2 & Nbsp; < BR />

Attribute description:

Targetcontrolid: Textbox Control to be formatted.
Mask: format in the Textbox Control.
Onfocuscssclass: CSS style used when textbox gets focus.
Onvalidcssclass: the CSS style used when invalid characters are entered in textbox.
Messagevalidatortip: whether a prompt is displayed when the textbox inputs information. If the value is true, a prompt is displayed. If the value is false, no prompt is displayed.
Masktype: the type of verification performed by the characters entered in textbox. Date, number, and time are supported.

3) drag and drop a maskededitvalidator control on the page to verify the input content in the textbox.

The Code is as follows: 1 < C0: maskededitvalidator ID = "Maskededitvalidator1" Runat = "Server" Controlextender = "Maskededitextender1"
2 Controltovalidate = "Textbox1" Invalidvaluemessage = '"Invalid Message "'emptyvaluemessage = "Data is required" Isvalidempty = "False" Display = "Dynamic" Tooltipmessage = "Input date" > </ C0: maskededitvalidator > </ Div >
3

Attribute description:

Controlextender: The maskededitvalidator control that it extends.
Controltovalidate: It verifies the Textbox Control.
Emptyvaluemessage: the prompt message used when the content in textbox is empty.
Isvalidempty: Specifies whether the textbox can be empty. If the value is true, null is allowed. If the value is false, null is not allowed.
Display: Specifies the display mode of the control. Static, static, and none are available.
Tooltipmessage: the prompt information displayed when information is input in textbox.

4) press Ctrl + F5 to view the information in the browser.

As follows:

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.