MaskEditValidator does not validate correctly if the date format is dd/mm/yyyy.
Attached is the fix for the bug.
In the following file AjaxControlToolkitSource\AjaxControlToolkit\MaskedEdit\MaskedEditValidator.cs at Line 590 I added the below line of code.
ControlCulture = System.Globalization.CultureInfo.GetCultureInfo(Culture);
Below is a sample code snippet that now works after the fix.
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="dtpDate" runat="server" Format="dd/MM/yyyy" TargetControlID="txtDate" />
<ajaxToolkit:MaskedEditExtender ID="mskDate" runat="server" TargetControlID="txtDate"
MaskType="Date" Mask="99/99/9999" CultureName="en-GB" CultureDateFormat="DMY" OnInvalidCssClass="field_error"/>
<ajaxToolkit:MaskedEditValidator ID="mevDate" runat="server"
ControlExtender="mskDate"
ControlToValidate="txtDate"
InvalidValueMessage="Date is invalid. Format is dd/mm/yyyy."
Display="None"
ValidationGroup="CaptureFields" /> dd/mm/yyyy
Comments: How to attach above mentioned 2 files( MaskedEditValidator with fix.cs,MaskedEditBehavior.js) in the project. Do I need to remove the ajax toolkit dll.
Attached is the fix for the bug.
In the following file AjaxControlToolkitSource\AjaxControlToolkit\MaskedEdit\MaskedEditValidator.cs at Line 590 I added the below line of code.
ControlCulture = System.Globalization.CultureInfo.GetCultureInfo(Culture);
Below is a sample code snippet that now works after the fix.
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="dtpDate" runat="server" Format="dd/MM/yyyy" TargetControlID="txtDate" />
<ajaxToolkit:MaskedEditExtender ID="mskDate" runat="server" TargetControlID="txtDate"
MaskType="Date" Mask="99/99/9999" CultureName="en-GB" CultureDateFormat="DMY" OnInvalidCssClass="field_error"/>
<ajaxToolkit:MaskedEditValidator ID="mevDate" runat="server"
ControlExtender="mskDate"
ControlToValidate="txtDate"
InvalidValueMessage="Date is invalid. Format is dd/mm/yyyy."
Display="None"
ValidationGroup="CaptureFields" /> dd/mm/yyyy
Comments: How to attach above mentioned 2 files( MaskedEditValidator with fix.cs,MaskedEditBehavior.js) in the project. Do I need to remove the ajax toolkit dll.