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

Declarative aggregate for a GridTemplateColumn

2 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 25 Nov 2009, 01:50 AM
Using the following template column code I can define an aggregate for the column, but nothing is displayed. Does the declarative aggregate work now for a GridTemplateColumn, and if so, what can I do to display the result?

<telerik:GridTemplateColumn UniqueName="IsInvitationAccepted"
    DataField="IsInvitationAccepted"
    HeaderText="Confirmed?"
    HeaderTooltip="Has this speaker confirmed their acceptance?"
    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
    FooterStyle-HorizontalAlign="Center"
    Aggregate="Sum" FooterAggregateFormatString="Confirmed: {0:F0}"
    >
    <ItemTemplate>
        <asp:Label ID="LabelInvitationAccepted" runat="server" 
            Text='<%# Convert.ToInt32(Eval("IsInvitationAccepted"))==1?"Yes":"No" %>' />
    </ItemTemplate>
</telerik:GridTemplateColumn>

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Nov 2009, 08:11 AM
Hi Paul,

I believe, specifying declarative aggregates for template columns is not yet supported by RadGrid. You would have to use custom code to set the aggregate. Information about how to calculate the aggregate sum footer for template column is available in the following help topic under the section 'Client-side calculation of totals for a template column':
Totals in grid footers

Thanks,
Princy.
0
The Wire
Top achievements
Rank 1
answered on 16 Apr 2010, 10:16 PM
http://www.telerik.com/community/forums/aspnet-ajax/grid/gridtemplatecolumn-aggregate-property.aspx#982442

The post above states that declarative aggregates in gridtemplatecolumn would be supported in Q3 2009 release of RadGrid which, according to that post, should have been in early november 2009.

However, I have the Q1 2010 release of 4/15/10 installed and aggregates are not working. 
<rad:GridTemplateColumn HeaderText="Qty" HeaderStyle-Width="40" Aggregate="Sum"  DataField="Qty" FooterAggregateFormatString="{0:F}">  
    <ItemTemplate><%# Eval("Qty") %></ItemTemplate>  
    <EditItemTemplate><asp:TextBox ID="txtQty" runat="server" Text='<%# Eval("Qty") %>' Width="40" /></EditItemTemplate>  
</rad:GridTemplateColumn> 
<rad:GridTemplateColumn HeaderText="Price" HeaderStyle-Width="40" Aggregate="Sum" DataField="Price" FooterAggregateFormatString="{0:C}">  
    <ItemTemplate><%# Eval("Price") %></ItemTemplate>  
    <EditItemTemplate><asp:TextBox ID="txtPrice" runat="server" Text='<%# Eval("Price") %>' Width="40" /></EditItemTemplate>  
</rad:GridTemplateColumn> 
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
The Wire
Top achievements
Rank 1
Share this question
or