DataGrid Column Width entered as percentage is throwing error in version 24.1.41 and above

A DataGrid Column with a width value entered as a percentage string is throwing errors.

This is happening with a .net8 project and Syncfusion version 24.1.41 (and above)


 <GridColumn Field=@nameof(MessageModel.Title)
          HeaderText="Title"
          TextAlign="TextAlign.Left"
          ClipMode="ClipMode.EllipsisWithTooltip"
          Width="18%" >

Error message in browser dev tools console:

invoke-js.ts:176 fail: Microsoft.AspNetCore.Components.Web.ErrorBoundary[0]

System.FormatException: The input string '18%' was not in a correct format.

at System.Number.ThrowFormatException[Char](ReadOnlySpan`1 value)

at System.Number.ParseFloat[Char,Double](ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)

at System.Double.Parse(ReadOnlySpan`1 s, NumberStyles style, IFormatProvider provider)

at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)

at System.Double.Parse(String s, IFormatProvider provider)


---------------


System.FormatException: The input string '18%' was not in a correct format.

at System.Number.ThrowFormatException[Char](ReadOnlySpan`1 value)

at System.Number.ParseFloat[Char,Double](ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)

at System.Double.Parse(ReadOnlySpan`1 s, NumberStyles style, IFormatProvider provider)

at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)

at System.Double.Parse(String s, IFormatProvider provider)


It only works if I define the Column's percentage value as a CustomAttribute:


                <GridColumn Field=@nameof(MessageModel.Title)

                            HeaderText="Title"

                            TextAlign="TextAlign.Left"

                            ClipMode="ClipMode.EllipsisWithTooltip"

                            CustomAttributes="@(new Dictionary<string, object>(){ { "width", "18%"} })" >


2 Replies

MS Monisha Saravanan Syncfusion Team January 8, 2024 09:24 AM UTC


Hi David,


Greetings from Syncfusion.


We have faced a similar issue with similar stacktrace from our 24.1.41 version and we have fixed and included the fix for the issue internally at our end and this will be included in our upcoming patch release which is expected to be rolled out on or before January 10th 2024.


We will get back to you once the reported issue resolved at our end. Until then we appreciate your patience.


Regards,

Monisha



MS Monisha Saravanan Syncfusion Team January 18, 2024 03:43 AM UTC

Hi David,

We are glad to announce that, we have included the fix for the issue “Exception is thrown when defining the Frozen Grid width property with percentage value” in our 24.1.45 release.  So please upgrade to our latest version of the Syncfusion package to resolve the reported issue.

NuGet: https://www.nuget.org/packages/Syncfusion.Blazor.Grid

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 


Loader.
Up arrow icon