Hi! I have a project with a RadGrid table showing information. I have this snippet of code inside it:
<telerik:GridCalculatedColumn DataFields="Stake,TotalGames" Expression="iif({1} = 0, 0, {0}/{1})"
FilterControlWidth="40px" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
UniqueName="AvgBet" DataFormatString="{0:N2}" HeaderText="Avg Bet (Real)" DataType="System.Decimal"
Aggregate="Avg" FooterStyle-HorizontalAlign="Right" />
Now, this works with English and Chinese locale settings. However, when we set the locale to ES, the formatting changes (from 0.00 to 0,00), and we believe that the problem is coming from the Expression in the code. We think that it might be that the values were interpreted as string? It works with English and Chinese locale (maybe because of the standard number decimal formatting).
We have tried these approaches but to no avail:
1. On binding data (OnNeedDataSource), we modify the locale like this:
if (dtable.Locale.ToString().Substring(0,2) == "es")
{
System.Globalization.CultureInfo myCultureInfo = new System.Globalization.CultureInfo("en-gb");
dtable.Locale = myCultureInfo;
}
However, this still shows the same problem.
2. We tried this as well (IsLocalizationLanguageRespected set to true or false):
<telerik:RadGrid ID="grdSessions" runat="server" GridLines="None" AllowFilteringByColumn="True"
PageSize="50" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
GroupHeaderItemStyle-Font-Bold="true" GroupHeaderItemStyle-ForeColor="Black"
EnableHeaderContextMenu="True" OnNeedDataSource="grdSessions_NeedDataSource"
Width="98%" ShowFooter="true" IsLocalizationLanguageRespected="false">
We are not sure how to approach this one next. Can you give me suggestions on how to proceed?
Thank you!
Psalm