RadGrid applying cultural formatting to property values?

4 posts, 0 answers
  1. abramsm
    abramsm avatar
    3 posts
    Member since:
    Jan 2007

    Posted 09 May Link to this post

    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.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 12 May Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. abramsm
    abramsm avatar
    3 posts
    Member since:
    Jan 2007

    Posted 12 May in reply to Konstantin Dikov Link to this post

    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.

  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 16 May Link to this post

    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.
Back to Top