
Saurabh Srivastava
Top achievements
Rank 1
Saurabh Srivastava
asked on 13 Aug 2009, 04:32 PM
Hi,
Is there a way to insert a summary/total row at the end of the grid? I am not using any grouping. It is just a simple datatable being bound to the grid.
Thanks,
Saurabh
Is there a way to insert a summary/total row at the end of the grid? I am not using any grouping. It is just a simple datatable being bound to the grid.
Thanks,
Saurabh
5 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 14 Aug 2009, 04:28 AM
Hi Saurabh,
RadGrid provides an intuitive method to define aggregates on a per-column basis from design time and render the results inside the respective column's footer.
Set the ShowFooter property of RadGrid to True and define aggregate property to sum which returns the sum of all column values in the source. Checkout the online demo.
Also checkout the documentation which shows how to modify the grid footer(s) or process calculations.
Totals in grid footers
-Shinu.
RadGrid provides an intuitive method to define aggregates on a per-column basis from design time and render the results inside the respective column's footer.
Set the ShowFooter property of RadGrid to True and define aggregate property to sum which returns the sum of all column values in the source. Checkout the online demo.
Also checkout the documentation which shows how to modify the grid footer(s) or process calculations.
Totals in grid footers
-Shinu.
0

Saurabh Srivastava
Top achievements
Rank 1
answered on 14 Aug 2009, 08:44 AM
Hi Shinu,
Thanks for the response. This does solve my issue. However, I am not able to get the text label to go along with my aggregate values. Here's a snapshot of my grid
Thanks for the response. This does solve my issue. However, I am not able to get the text label to go along with my aggregate values. Here's a snapshot of my grid
<telerik:RadGrid ID="rgVoyageDetails" runat="server" Width="100%" Skin="Custom" EnableEmbeddedSkins="false" AutoGenerateColumns="false" |
AllowSorting="false" AllowPaging="false" AllowFilteringByColumn="false" ShowFooter="true"> |
<MasterTableView> |
<Columns> |
<telerik:GridBoundColumn UniqueName="StartPort" HeaderText="Start Port" DataField="StartPortName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="StartArea" HeaderText="Start Area" DataField="StartAreaName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="EndPort" HeaderText="End Port" DataField="EndPortName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="EndArea" HeaderText="End Area" DataField="EndAreaName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="CargoName" HeaderText="Cargo Name" DataField="CargoName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="CargoType" HeaderText="Cargo Type" DataField="CargoTypeName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="Days" HeaderText="Days" DataField="DaysNum"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="Quantity" HeaderText="Quantity" DataField="Quantity" DataFormatString="{0:#,###.##}" Aggregate="Avg" FooterText="Average Quantity: " ></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="Price" HeaderText="Price" DataField="Price" DataFormatString="{0:#,###.##}" Aggregate="Avg" FooterText="Average Price: " ></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="TotalCost" HeaderText="Total Risk" DataField="TotalCost" DataFormatString="{0:#,###.##}" Aggregate="Sum" FooterText="Total Cost: "></telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
0
Accepted

Shinu
Top achievements
Rank 2
answered on 14 Aug 2009, 10:06 AM
Hello Saurabh,
You would have to use the FooterAggregateFormatString for the column as shown below:
c#:
You would have to use the FooterAggregateFormatString for the column as shown below:
c#:
<telerik:GridBoundColumn UniqueName="TotalCost" HeaderText="Total Risk" DataField="TotalCost" DataFormatString="{0:#,###.##}" Aggregate="Sum" |
FooterAggregateFormatString="Custom Text : {0}"></telerik:GridBoundColumn> |
Thanks
Shinu.
0

Mark
Top achievements
Rank 1
answered on 09 Jan 2013, 04:44 PM
Is there a way to do summary in the header instead? I also need to do summary on various of levels depends on how radgrid data grouping. Please see the sample image in attached file, let me know if you can provide any sample project to achieve this.
thanks
Mark
thanks
Mark
0

Shinu
Top achievements
Rank 2
answered on 10 Jan 2013, 04:30 AM
Hi,
Try the following code snippet you could show the footer aggregates into the RadGrid header.
C#:
Thanks,
Shinu.
Try the following code snippet you could show the footer aggregates into the RadGrid header.
C#:
protected
void
RadGrid2_PreRender1(
object
sender, EventArgs e)
{
GridHeaderItem header = RadGrid2.MasterTableView.GetItems(GridItemType.Header)[0]
as
GridHeaderItem;
GridFooterItem footer = RadGrid2.MasterTableView.GetItems(GridItemType.Footer)[0]
as
GridFooterItem;
foreach
(GridColumn column
in
RadGrid2.MasterTableView.Columns)
{
var value = footer[column.UniqueName].Text;
header[column.UniqueName].Text +=
"<br/>"
+ value;
}
}
Thanks,
Shinu.