articles

Home / DeveloperSection / Articles / AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

Uttam Misra25244 25-Sep-2010

MaskedEditExtender: It restricts the end user from entering specific text within textbox control.

It contains main key properties TargetControlID and MaskType (this property indicates the type of mask or filter to place on the textbox. In MaskType, there are possible values:

None: No validation will be performed.

Date: Date validation will occur.

Date Time: Date and Time validation will occur.

Number: A number validation will exist.

Time: A time validation will occur.

 MaskedEditValidator: It work with above control and it show the massage on incorrect input. It has important key properties as ControlExtender,  ControlToValidate, Display etc.

How we implement the Update Progress server control

 Example:

   Step1: we use the following control on aspx page

 <div>
<%--Using ScriptManager or ToolkitScriptManager according toolkit version--%>
<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<%-- add the MaskedEditExtender and MaskedEditValidator--%>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<cc1:MaskedEditExtenderID="MaskedEditExtender1"runat="server"TargetControlID="TextBox1" MaskType="number"Mask="9999"  UserDateFormat="MonthDayYear"></cc1:MaskedEditExtender>       
<cc1:MaskedEditValidatorID="MaskedEditValidator1"runat="server"ControlToValidate="TextBox1"IsValidEmpty="false"
ControlExtender="MaskedEditExtender1"  Display="Dynamic" EmptyValueMessage="Enter correct format">
</cc1:MaskedEditValidator>
</div>

   Step2: Run the project

AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

Enter the value

AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

If we do not enter the value

AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

    


Updated 04-Mar-2020
More than 18 years of working experience in IT sector. We are here to serve you best.

Leave Comment

Comments

Liked By