Group Header Totals

2 posts, 0 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 14 Sep 2013 Link to this post


    I know we can perform calculations and add them to a group header:

    Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
     
        If TypeOf e.Item Is GridGroupHeaderItem Then
            Dim item As GridGroupHeaderItem = CType(e.Item, GridGroupHeaderItem)
            Dim groupDataRow As DataRowView = CType(e.Item.DataItem, DataRowView)
            item.DataCell.Text = (item.DataCell.Text + "; Avg: ")
            item.DataCell.Text = (item.DataCell.Text + (CType(groupDataRow("total"), Decimal) / Integer.Parse(groupDataRow("count").ToString)).ToString)
        End If
    End Sub

    But is there a way to just add the Column aggregate:
    <telerik:GridBoundColumn DataField="Subject" FilterControlAltText="Filter Subject column"
    HeaderText="Subject" SortExpression="Subject" UniqueName="Subject" ItemStyle-HorizontalAlign="Left"
    FooterStyle-HorizontalAlign="Left" FooterText="Tickets " Aggregate="Count">
    </telerik:GridBoundColumn>

    Thank you in advance.




  2. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 19 Sep 2013 Link to this post

    Hi Allan,

    Please check out the following live example which demonstrates how to use the aggregate into the footer on the groups.

    Regards,
    Kostadin
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top