Grid Column format for decimal value type


I am trying to implement following functionality but I can't get format to work..
Here is what I have:

[Column(TypeName = "decimal(18,4)")]
public decimal ArrivalFee { get; set; }

When I try to load it on a grid I get value formatted to 0.0000 which is fine

RadzenGridColumn TItem="ContractorRate" Property="ArrivalFee" Title="Arrival Fee" FormatString="0.00" Type="decimal" Width="140px"
EditTemplate Context="ArrivalCost"
RadzenNumeric Min="0" @bind-Value="@ArrivalCost.ArrivalFee" /
however I would like to show it on a grid as 0.00 but store value as 0.0000

I tried following and none of them worked:

FormatString="0.00" Type="decimal"
FormatString="{0.00}" Type="decimal"
FormatString="0.00" Type="string"
FormatString="{0.00}" Type="string"

Format="0.00" Type="decimal"
Format="{0.00}" Type="decimal"
Format="0.00" Type="string"
Format="{0.00}" Type="string"

Does anyone know how or if this is even possible?

Hi @bomner,

Radzen passes the FormatString property of the column directly to String.Format and renders its output:

@(String.Format(column.FormatString, PropertyAccess.GetValue(item, column.Property)));

I suggest you double-check your format string.

In case anyone else lands here like I did, here are a couple examples for FormatString:

  • Show 1.2345 as 1.23
  • Show 2.340 as $2.34

This kind of sample needs to be put into the documentation.

For anyone else that comes across this thread, here is a example of how this would be implemented as a RadzenDataGridColumn:

<RadzenDataGridColumn TItem="TblTransaction" Property="SubTotal" Title="SubTotal" FormatString="{0:C2}" Width="50px" />

Outputs: $250.25