[Solved] Ajax CalendarExtender not working with MaskedEditExtender in ASP.Net

rakeshkuma
 
on Jan 27, 2021 12:19 AM
Sample_976851.zip
1712 Views

Ajax CalendarExtender not working with MaskedEditExtender in ASP.Net

<asp:TextBox ID="TextBox5" runat="server" Width="130px" MaxLength="1" style="text-align:justify" ValidationGroup="MKE" />
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="TextBox5" Mask="99-99-9999" MessageValidatorTip="true" CultureName="en-nz" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError"
    MaskType="Date" DisplayMoney="Left" AcceptNegative="Left" ErrorTooltipEnabled="True" />
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator5" runat="server" ControlExtender="MaskedEditExtender5" ControlToValidate="TextBox5" InvalidValueMessage="Date is invalid"
    Display="Dynamic" IsValidEmpty="true" InvalidValueBlurredMessage="Date is invalid" ValidationGroup="MKE" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd-MM-yyyyy" TargetControlID="TextBox5" />

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jan 28, 2021 03:42 AM

Refer below code.

HTML

<asp:Button Text="Save" runat="server" ValidationGroup="MKE" />
<ajaxtoolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxtoolkit:ToolkitScriptManager>
<asp:TextBox ID="txtCDate1" runat="server" Text="" Width="100" MaxLength="10" ValidationGroup="MKE"></asp:TextBox>
<ajaxtoolkit:MaskedEditExtender runat="server" ID="MaskedEditExtender1" ClearMaskOnLostFocus="false"
    MaskType="Date" Mask="99/99/9999" UserDateFormat="DayMonthYear" TargetControlID="txtCDate1">
</ajaxtoolkit:MaskedEditExtender>
<ajaxtoolkit:MaskedEditValidator runat="server" ID="MaskedEditValidator1" ControlToValidate="txtCDate1"
    ControlExtender="MaskedEditExtender1" Display="dynamic" ValidationGroup="MKE" InvalidValueBlurredMessage="Date is invalid" />
<ajaxtoolkit:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="txtCDate1"
    Format="dd/MM/yyyy">
</ajaxtoolkit:CalendarExtender>

Screenshot