Telerik ASP.NET Radgrid group footer aggregation

I need to write a grid that will group and total in the footer. I do this often enough that I really should have a template but I don't... so here it is

Items to note: 'ShowFooter' in the main declaration, 'ShowGroupFooter' in the MasterTableView, and the column needs to look like this:

<telerik:GridBoundColumn DataField="Total" HeaderText="Total" DataFormatString="{0:0.00}" FooterAggregateFormatString="Total: {0:0.00}" Aggregate="Sum" FooterText="Total:"  ></telerik:GridBoundColumn>

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" RenderMode="Lightweight"
        Width="100%" ShowFooter="true">
    <MasterTableView DataKeyNames="Invoice" ShowGroupFooter="true"   >
        <SortExpressions>
            <telerik:GridSortExpression FieldName="Subdiv"  />
            <telerik:GridSortExpression FieldName="Lot"  />
        </SortExpressions>
        <GroupHeaderTemplate>
            <asp:Label ID="lblSubdiv" CssClass="Bold" runat="server" Text='<%# Bind("Subdiv") %>' ></asp:Label> -
            <asp:Label ID="Label1" CssClass="Bold" runat="server" Text='<%# Bind("Lot") %>' ></asp:Label>
        </GroupHeaderTemplate>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField HeaderText="Subdiv" FieldName="Subdiv" ></telerik:GridGroupByField>
                </SelectFields>
                <GroupByFields >
                    <telerik:GridGroupByField FieldName="Lot"  />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <Columns>
            <telerik:GridBoundColumn DataField="Lot" HeaderText="Lot"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CUSTNMBR" HeaderText="CUSTNMBR"></telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="DOCDATE" HeaderText="DOCDATE" DataFormatString="{0:MM/dd/yy}"></telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Invoice" HeaderText="Invoice"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="VendInv" HeaderText="Vend Inv"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Task" HeaderText="Task"></telerik:GridBoundColumn>
            <telerik:GridNumericColumn DataField="Quantity" HeaderText="Quantity" DataFormatString="{0:0}"></telerik:GridNumericColumn>
            <telerik:GridNumericColumn DataField="Cost" HeaderText="Cost" DataFormatString="{0:0.00}" ></telerik:GridNumericColumn>
            <telerik:GridBoundColumn DataField="Total" HeaderText="Total" DataFormatString="{0:0.00}" FooterAggregateFormatString="Total: {0:0.00}" Aggregate="Sum" FooterText="Total:"  ></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

 

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences