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: