8 votes
closed
MaskEditExtender not respecting Page Culture

Description

 
The MaskedEditExtender does not default to the page culture, it defaults to en-US. This created the inability to create a custom culture for the page and have the MaskedEditExtender respect it. The control should use the page culture unless one is specifically set for the control.


Closed Sep 13 2007 at 3:00 AM  by kirtid

Comments

most recent at top (show oldest at top)
wrote Sep 13 2007 at 3:00 AM
Resolved with changeset 26784.

crymsan wrote Sep 12 2007 at 5:23 PM
From what I recall, you should be able to still use CultureName. The main chunk of stuff that I removed was all the explicit US culture settings.

wrote Sep 5 2007 at 9:21 PM
Look at the patch fix to see if it solves the problem.

davidt wrote Aug 30 2007 at 9:57 AM
Nice fix. My only problem with this fix (unless i've missed something) is that in it requires you to specify all the culture settings, you can't specify the culture name anymore. All the setting of culture settings has been removed from the OnPreRender method in MaskedEditExtender.cs
What i've done is use the patched javascript (MaskedEditBehavior.js) but left the .cs files alone and then specified CultureDatePlaceholder="-" on my MaskedEditExtender.

I did have to make one change to the patched javascript on line 3074:
m_mask = m_mask.split("/");
This was causing line 3080 to have an out of range error
if (D.length < m_mask[this.get_CultureDateFormat().indexOf("D")].length)

i just changed line 3074 to:
m_mask = m_mask.split(this.get_CultureDatePlaceholder());
and it works.

Thanks for the patch Luc1an.

crymsan wrote Aug 27 2007 at 2:35 PM
HI Luc1an, I looked at the code and I think it's working the way it should be. The mask that is set in the control strictly uses "/" for dates, ":" for time, "," for thousands, and "." for decimals. While this can be confusing, I don't know how easily it can be changed (not sure how widely it is used). It should function properly however if you use the mask as a template (using "/" for dates) and then set the DatePlaceholder to a period.

Luc1an wrote Aug 27 2007 at 1:21 PM
Also there is an issue in the private method _createMask(...) with the date separator, Let's say if the date separator is "." (some cultures do have that) then the mask is not going to be all right.
I can point the line where you can update the code: it's around 3771.

The patch code could be like this or improved:

else if (text.substring(i, i+1) == ".")
{
// Patch: keep it as it is for datetime format
if (this.get_MaskType() == AjaxControlToolkit.MaskedEditType.Number)
{
masktext += this.get_CultureDecimalPlaceholder();
maskvld += ",";
this._LogicTextMask += this.get_CultureDecimalPlaceholder();
}
else
{
masktext += this.get_CultureDatePlaceholder();
maskvld += ".";
this._LogicTextMask += this.get_CultureDatePlaceholder();
}
}

crymsan wrote Aug 26 2007 at 3:44 AM
The MaskedEditValidator still needed to be changed. This updated patch changes both and appears to be working fine.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987