The MaskedEdit control is an ASP.NET AJAX control that can be attached to a TextBox control. The supported data formats are: Number, Date, Time, and DateTime. MaskedEdit uses the culture settings specified in the CultureName property. If none is specified the culture setting will be the same as the page: English (United States).
The MaskedEdit control has to be integrated with the MaskedEditValidator to verify the input.
It validates date formats entering. It is also used for time and number formats also.
Original Article from
www.codeforasp.net
Using Masked Edit Extender with calendar control
Step1: Open Visual Studio ,Create a new web Application (Ajax Enabled Application)
Step2: Check Script Manager is added or not in Default.aspx page. If it is not added
Drag script manager control from Ajax toolkit in Toolbox.
Step3: Add Textbox control , Ajax Calender Control, Ajax Maked Edit Extender control
step4: Set the Mask property to of the extender to ”99/99/9999″, MaskType property “Date”, TargetControlID to “TextBox1″
step5: MaskType property plays major role for Masked Edit Extender . It describes
Mask type date, number, time and Datetime
Mask=”99/99/9999″
MaskType=”Date”
TargetControlID=”TextBox1″
Step6: Then drag and drop MaskedEditValidator into the page. Set the properties of
the MaskedEditValidator as follows:
set properties
ControlExtender=”TextBox1_MaskedEditExtender”
ControlToValidate=”TextBox1″
Display=”Dynamic”
EmptyValueMessage=”A Date is Required”
Sample Code look like this:
<asp:TextBox ID=”TextBox1″ runat=”server” ></asp:TextBox>
<cc1:MaskedEditExtender ID=”TextBox1_MaskedEditExtender” runat=”server”
CultureName=”en-AU” Enabled=”True” Mask=”99/99/9999″ MaskType=”Date” TargetControlID=”TextBox1″/>
<cc1:MaskedEditValidator ID=”mev1″ runat=”server”
ControlExtender=”TextBox1_MaskedEditExtender” ControlToValidate=”TextBox1″
Display=”Dynamic”
EmptyValueMessage=”A Date is Required”
InvalidValueMessage=”The Date is Invalid”
IsValidEmpty=”False” TooltipMessage=”Please Enter a Date”/>
<cc1:CalendarExtender ID=”CalendarExtender1″ runat=”server” PopupButtonID=”TextBox1″ Format=”dd/MM/yyyy”
TargetControlID=”TextBox1″></cc1:CalendarExtender>