This is a migrated thread and some comments may be shown as answers.

group footer

2 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 18 Nov 2008, 03:30 PM
Hi,

I have GridNumericColumn : 

                                    <telerik:GridNumericColumn
                                        UniqueName="AreaSize"
                                        HeaderText="GFA Size"
                                        DataField="area_size"
                                        Visible="true"
                                        FooterText="Total: "
                                        Aggregate="Sum"            
                                        ItemStyle-Height="10px">
                                        <ItemStyle Width="100px" HorizontalAlign="Right"  />
                                    </telerik:GridNumericColumn>

I want to show the text "total:" in the group footer, but when I added  <DataFormatString="{0:###,###.##}">  in the column,
footer text will disapear, I want to show the footer text and set the dataformatstring,

Please help.

Regards,

Paul.

2 Answers, 1 is accepted

Sort by
0
Accepted
Kevin Babcock
Top achievements
Rank 1
answered on 19 Nov 2008, 07:14 AM
Hi Paul,

Try setting the GridNumericColumn's FooterAggregateFormatString property to "Total: {0:###,###.##}"

Here is a simple example using the Northwind database. Note the FooterAggregateFormatString on the highlighted line.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Telerik.Examples._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Example</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
     
        <telerik:RadGrid ID="RadGrid1" runat="server" 
            AllowPaging="true" 
            AutoGenerateColumns="false" 
            DataSourceID="SqlDataSource1" 
            PageSize="20" 
            ShowFooter="true"
            <MasterTableView 
                ShowGroupFooter="true"
                <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField 
                                FieldAlias="CategoryName" 
                                FieldName="CategoryName" /> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField 
                                FieldName="CategoryName" 
                                SortOrder="Descending" /> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
                <Columns> 
                    <telerik:GridBoundColumn 
                        DataField="ProductID" 
                        HeaderText="ProductID"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn 
                        DataField="ProductName" 
                        HeaderText="ProductName"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn 
                        DataField="CategoryName" 
                        HeaderText="CategoryName"
                    </telerik:GridBoundColumn> 
                    <telerik:GridNumericColumn 
                        Aggregate="Sum"  
                        DataField="UnitPrice" 
                        FooterAggregateFormatString="Total: {0:###,###.##}"                  
                        HeaderText="UnitPrice"                       
                        UniqueName="UnitPrice"
                        <ItemStyle  
                            Height="25px" 
                            HorizontalAlign="Right" 
                            Width="100px" />                                 
                    </telerik:GridNumericColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
     
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"  
            SelectCommand="SELECT Products.ProductID, Products.ProductName, Products.CategoryID, Categories.CategoryName, Products.UnitPrice, Products.UnitsInStock FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID"
        </asp:SqlDataSource> 
    </form> 
</body> 
</html> 
 

I hope this helps. Please let me know if you need additional help.

Regards,
Kevin Babcock
0
Paul
Top achievements
Rank 1
answered on 19 Nov 2008, 08:05 AM
cool , thanks a lot.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Share this question
or