MaskedEditValidator Page.IsValid returns false when using "en-UK" culture RRS feed

  • Question

  • User-583524385 posted

                                            <asp:TextBox id="txtDate" runat="server" Width="70"
                                            Text='<%# DataBinder.Eval(Container.DataItem, "Date") %>'/>
                                            <atk:MaskedEditExtender ID="meeDate" CultureName="en-GB" runat="server" Mask="99/99/9999" MaskType="Date" TargetControlID="txtDate" PromptCharacter="_" />        
                                            <atk:MaskedEditValidator ID="mevDate" runat="server" ControlExtender="meeDate" ControlToValidate="txtDate" 
                                            EmptyValueMessage=" *" InvalidValueMessage="Date is invalid" IsValidEmpty="False" CssClass="validatorError" />

    The following setup seems to work fine on the client side, however when I post back and check Page.IsValid, the value is false.  I also looked at mevDate.IsValid and it's false.  It seems that setting the CultulreName on the MaskedEditExtender is sufficient to get the MaskedEditValidator to emit the correct JavaScript, but on the server side of things it doesn't work.  When I flip CultureName to "en-US" everything works as expected.

    Friday, February 4, 2011 3:17 PM

All replies

  • User-736607127 posted


    write ur scriptmanager as

    <asp:ScriptManager ID="ScriptManager1" runat="server"
                EnableScriptGlobalization="true"    EnableScriptLocalization="true" />
    the following are important while working with Cultures..

    If my solution is a correct answer to u,

    Please Mark as ANSWER.

    Many Thanks,

    Gouse Baig.

    Sunday, February 6, 2011 7:32 AM
  • User-583524385 posted

    Setting these properties on the ScriptManager did not seem to make a difference.  Page.IsValid is still false on the postback.

    Monday, February 7, 2011 9:29 AM
  • User-583524385 posted

    One interesting thing I noticed is during debugging if you look at the MaskedEditValidator members, you’ll notice that the private member _Culture is set to “en-US” while the MaskedEditExtender is properly set to “en-GB”.

    Wednesday, February 9, 2011 11:30 AM
  • User-1027466839 posted

    Came across this post when experiencing the same issue after updating to the Dec 2013 toolkit (v. 

    I found that I needed to add the UserDateFormat="DayMonthYear" property.


    <cc1:MaskedEditExtender ID="meeDR" runat="server" TargetControlID="txtDateReceived" CultureName="en-GB" UserDateFormat="DayMonthYear" Mask="99/99/9999" ClearMaskOnLostFocus="true" />

    Note that I have also found the mask will not clear properly, despite the "ClearMaskOnLostFocus=true", so have added custom attributes to each date control when the page first loads:

    'Add custom attributes to fix AjaxControlToolkit.
    'When using the MaskedEditExtenders, the mask does not disappear correctly in Toolkit version >= 4.1.7
    'RegExp call replaces "_" and "/" chars with empty string (""). 
    'Parameter "g" on the RegExp constructor = replace all matches, rather than only the first one.
    Me.txtDateReceived.Attributes.Add("onblur", "this.value = this.value.replace(new RegExp(""[_/]"", ""g""), """");")

    Thursday, October 30, 2014 7:17 AM