This is a migrated thread and some comments may be shown as answers.

RadGrid applying cultural formatting to property values?

3 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
abramsm
Top achievements
Rank 1
abramsm asked on 09 May 2016, 09:28 PM
I'm using a RadGrid in a multi-language/multi-cultural web application.  This grid contains columns with fractional Width values and am seeing the rendered HTML is invalid when the page's culture is set to one that uses commas for decimal places.  To recreate the issue, I created a very simple web app with a RadGrid and added a GridDateTimeColumn defined like this:

<telerik:RadGrid runat="server" ID="RadGrid1">
  <MasterTableView>
    <Columns>
      <telerik:GridDateTimeColumn HeaderStyle-Width="10.5em" UniqueName="Col1" DataField="Col1" />
      <telerik:GridDateTimeColumn HeaderStyle-Width="15.8em" UniqueName="Col2" DataField="Col2" />
    </Columns>
  </MasterTableView>
</telerik:RadGrid>

When setting the Page's Culture property to one that uses a comma as the decimal place (for example "fr-FR") the rendered grid also has the format applied to the property value, which is certainly undesirable.  In Internet Explorer, these invalid strings are ignored and replaced with an empty property value, however Chrome renders these grids as follows:

<table class="rgMasterTable" id="RadGrid1_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
  <colgroup>
    <col style="width:10,5em" />
    <col style="width:15,8em" />
  </colgroup>
<thead>

While the browsers appear to output some default column widths (thus ignoring the invalid values), where things really go wrong is when trying to persist the grid's settings using a RadPersistenceManager.  When trying to reload the grid's columns widths, an error is encountered due to trying to load the invalid number formats, or in other cases the grid is rendered with the columns completely missing from the display.

I'm not sure if it's against best practice to use fractional values for Width properties, but we have done this in a number of places in our application and it does not appear to be a problem with generic ASP.NET controls such as GridViews where they aren't trying to apply a format to a property value.

I would appreciate some guidance... are we violating a best practice, missing something obvious, or is this a bug in the RadGrid, column control, or (less likely) the RadPersistenceManager?


I'm running the 2016-Q2 release of the controls and am developing in a .NET 4.5 application.

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 12 May 2016, 10:02 AM
Hi,

Indeed, setting "em" with decimal values will not work for cultures where the decimal separator is ",". I am logging this as a bug, so that the scenario could be further investigated by our developers team.

Currently, the only thing that I could suggest is to either use integer values for the width or replace the command with dot on client-side.

Please excuse us for any inconvenience caused by this.


Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
abramsm
Top achievements
Rank 1
answered on 12 May 2016, 03:44 PM

Thank you for the response.  

We have started altering our markup to use only whole number values where applicable, thus avoiding this issue all together.

0
Konstantin Dikov
Telerik team
answered on 17 May 2016, 08:59 AM
Hi Mark,

I am glad to inform you that the issue is already fixed and that fix should be available in our next official release.

Once again, please excuse us for any inconvenience caused by this.


Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
abramsm
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
abramsm
Top achievements
Rank 1
Share this question
or