Normal 0 false false false RU X-NONE X-NONE
Hi,
I have edited WebDataGrid localization issue. My Page.OnInit sets the current culture as follows:
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE");
DateTime and Numeric values are displayed OK:
13.02.2000 81796,50
16.12.2007 232995,00
22.06.2005 1340,00
09.09.2009 23456,50
Then I edit those values. After exit from editing mode WebDataGrid displays the edited values ignoring localization settings:
13/02/2000 81796.50
The way of current culture setting makes no matter. For example, the following code leads to the same result:
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");
I use the standard WebDateChooserProvider and WebNumericEditProvider
Explicit assigning WebDateChooserProvider.Culture and WebNumericEditProvider.Culture makes no matter too
thanks
Try setting EnableScriptGlobalization and EnableScriptLocalization off the ScriptManager to True.
Thank you. It works.
@Alex Kartavov:
I tried what you said and it did not work for me. I have the WebDataGrid inside an UpdatePanel so I do not know if this can be the be reason.
Does the WebDatasGrid have any property to set the culture info?
Thans a lot
No, everything should work off of the ScriptManager. If you can post a small example of what you are doing we can review it here. Thanks.
I have it set up as you mentioned in this thread, but my webdatagrid ignores all globalization settings,
I have my webscirptmanager as:
and for my code behind:
protected override void InitializeCulture() { string cultureCode = IFContext.UserPreferences.Settings.Culture; cultureCode = "hi-IN"; //this is overridden and hard coded for test reason //below is read-only so have to use CreateSpecificCultre instead //this.Culture = cultureCode; //this.UICulture = cultureCode; System.Globalization.CultureInfo cultr = System.Globalization.CultureInfo.CreateSpecificCulture(cultureCode); System.Globalization.CultureInfo cultUI = System.Globalization.CultureInfo.CreateSpecificCulture(cultureCode); cultr.NumberFormat.CurrencySymbol = string.Empty; cultUI.NumberFormat.CurrencySymbol = string.Empty; System.Threading.Thread.CurrentThread.CurrentCulture = cultr; System.Threading.Thread.CurrentThread.CurrentUICulture = cultUI; base.InitializeCulture(); }
for IG fields I set culcture as:
fldCFTotal.Culture = CultureInfo.CurrentUICulture;
For lablels I use format as:
lbl_BS_BMV.Text = String.Format(CultureInfo.CurrentUICulture, "{0:C}", ds.Tables[0].Rows[0]["Market_Value"]);
The all the fields work, but webdatagrid does not show any globalized formatting for currency, numbers or dates. For example I still see currency symbol in the grid columns but not in the fields.
The columns have dataformat properties set up as DataFormatString="{0:C}". What am I missing?
Forgot to page scriptmanager:
<ig13:WebScriptManager id="sm" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true"></ig13:WebScriptManager>
Problem resolved. This was issue with out master pages overriding culture after InitilizeCulture() methods ran.
Once that was fixed, IG controls and grid worked fine.