Telerik - ASP.NET RadGrid Footer Template and Detail Template

 This article contains template code to display Grid Footer Template and Detail Templates using a Telerik ASP.NET RadGrid. Sure, you can go to the documentation and get it... but that took me hours. Now I'll have it when I need it.

 

 

Since this grid is not hierarchal and only uses grouping, we only have one datasource that we populate in the standard NeedDataSource method

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BackColor="White"
    commanditemdisplay="Top" CssClass="grid" Skin="Default" AllowPaging="False" PageSize="9999"
    Width="100%" AllowAutomaticInserts="false" ShowFooter="true">
    <MasterTableView DataKeyNames="SOPNUMBE, SOPTYPE, LNITMSEQ" CommandItemDisplay="Top" EditMode="InPlace"  ShowGroupFooter="true" >
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="REQSHIPDATE" HeaderText="Req Ship Date" FormatString="{0:MM/dd/yyyy}" />
                    <telerik:GridGroupByField FieldName="sopnumbe" HeaderText="Order" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="REQSHIPDATE" HeaderText="REQSHIPDATE" />
                    <telerik:GridGroupByField FieldName="sopnumbe" HeaderText="REQSHIPDATE" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <GroupFooterTemplate>
            <asp:Label ID="lblOrderComment" runat="server" Text='<%# Eval("TXTHEADER")%>'> </asp:Label>
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("boxes")%>'> </asp:Label>
        </GroupFooterTemplate>
        <DetailItemTemplate>
            <%# Eval("txtline")%>
        </DetailItemTemplate>
        <Columns>
            <telerik:GridHyperLinkColumn DataTextFormatString="{0}" DataNavigateUrlFields="Dex_row_id"
              UniqueName="lnTable_Name" DataNavigateUrlFormatString="/PickingEdit.aspx?Dex_Row_ID={0}"
              Text="Edit"
            </telerik:GridHyperLinkColumn>
            <telerik:GridBoundColumn DataField="ITEMNMBR" HeaderText="Item Number" ReadOnly="True" UniqueName="itemnmbr"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="itemdesc" HeaderText="Item Desc" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SHIPMTHD" HeaderText="Ship Mthd" ReadOnly="True"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SHIPMTHD" HeaderText="Ship Mthd" ReadOnly="True"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="TXTHEADER" HeaderText="TXTHEADER" Aggregate="First" Visible="false"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="boxes" HeaderText="TXTHEADER" Aggregate="First" Visible="false"></telerik:GridBoundColumn>
            <telerik:GridDropDownColumn UniqueName="Status" ListTextField="Status" ListValueField="Status" ListDataMember="Status"
                HeaderText="Status" DataField="Status" DropDownControlType="DropDownList"
                AllowSorting="true" ReadOnly="false">
            </telerik:GridDropDownColumn>
        </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