DataGridColumn How to set calculated value to property

Hi,

In one of my data grid columns, I am calculating the property by multiplying other column values as follows. Is there a way to set the calculated value into TotalSellPrice in the column? I ask for help on this.

...
<RadzenDataGridColumn TItem="OrderDetail" Property="TotalSellPrice" Title="Total Sell" OrderIndex="12">
    <Template Context="detail">
           @switch (detail.Currency)
             {
                 case "Dolar":
                   @string.Format(new CultureInfo("en-US"), "{0:C}", detail.Quantity * detail.SellUnitPrice)
                    break;
                 case "Euro":
                    @string.Format(new CultureInfo("en-FR"), "{0:C}", detail.Quantity * detail.SellUnitPrice)
                    break;
                 default:
                   @string.Format(new CultureInfo("tr-TR"), "{0:C}", detail.Quantity * detail.SellUnitPrice)
                    break;
          }
    </Template>
</RadzenDataGridColumn>
...

Thank you.

Hi @Raysefo,

You can assign the value by enumerating your collection before databinding it to the RadzenDataGrid.

foreach (var item in data)
{
   item.TotalSellPrice = item.Quantity * item.SellUnitPrice;
}

Thank you @korchev, I was wondering if there is a way to do it in the column.