<SfGrid DataSource="@OrderData">
<GridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true">GridEditSettings>
<GridColumns>
@foreach (var prop in typeof(Order).GetProperties())
{
<GridColumn Field="@prop.Name" IsPrimaryKey="@(prop.Name == "OrderID")" AllowEditing="@prop.CanWrite">GridColumn>
}
GridColumns>
<GridAggregates>
<GridAggregate>
<GridAggregateColumns>
@foreach (var prop in typeof(Order).GetProperties())
{
var a =
prop;
if (prop.PropertyType.FullName
== "System.Nullable`1[[System.Double, System.Private.CoreLib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]")
{
<GridAggregateColumn Field[email protected] Type="AggregateType.Sum" Format="C2">
<FooterTemplate>
@{
var aggregate
= (context as AggregateTemplateContext);
<div>
<p>Sum: @aggregate.Sump>
div>
}
FooterTemplate>
GridAggregateColumn>
}
}
GridAggregateColumns>
GridAggregate>
GridAggregates>
SfGrid>
|