Users Pricing

articles

home / developersection / articles / ajax control toolkit: maskededitextender and maskededitvalidator

AJAX Control Toolkit: MaskedEditExtender and MaskedEditValidator

Uttam Misra 25869 25 Sep 2010 Updated 04 Mar 2020

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:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<%-- add the MaskedEditExtender and MaskedEditValidator--%>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1" MaskType="number" Mask="9999"  UserDateFormat="MonthDayYear"></cc1:MaskedEditExtender>       
<cc1:MaskedEditValidator ID="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

    


Uttam Misra

Information Technology

More than 18 years of working experience in IT sector. We are here to serve you best.