GridTemplateColumn with a "Custom" aggregate.

2 posts, 0 answers
  1. John Fetherolf
    John Fetherolf avatar
    17 posts
    Member since:
    Sep 2008

    Posted 28 Mar 2013 Link to this post

    I added a custom aggregate to a column that has an item template because it has a nifty rad tooltip to go with it.  Anyway when I return the custom aggregate from the event, the grid adds the string "Custom : " to the footer cell, and I am wondering why?  Also is there any other way to get rid of that other than what I had to do which was handle the footer cell in the ItemDataBound event as below?

    <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="OtherPay" HeaderText="Other<br />Pay">
            <asp:Label runat="server" ID="lblOtherPay">0</asp:Label>
            <telerik:RadToolTip runat="server" ID="ttPPED" TargetControlID="lblOtherPay" Position="BottomRight"
                Title="Other Pay" AutoCloseDelay="3000" Sticky="true" RelativeTo="Element"
                EnableShadow="false" EnableEmbeddedSkins="false" Skin="KMBlack">
        <HeaderStyle Width="8%" HorizontalAlign="Right" />
        <ItemStyle HorizontalAlign="Right" />
        <FooterStyle HorizontalAlign="Right" />

    protected void grid_CustomAggregate(object sender, GridCustomAggregateEventArgs e) {
        switch(e.Column.UniqueName) {
            //  For some reason adds the string "Custom : " to the footer cell...
            case "OtherPay":
                e.Result = string.Format("{0:#,##0}", _otherPayTotal);
    protected void gridPayPlanEntries_ItemDataBound(object sender, GridItemEventArgs e) {
        GridFooterItem footerItem = e.Item as GridFooterItem;
        //  Very strange Telerik issue here.  You may ask yourself, why didn't
        //  we do this as a custom aggregate on the GridTemplateColumn for other
        //  pay?  Well for some reason Telerik was adding the text "Custom : "
        //  to the cell in the footer with no apparent way to get rid of it.
        //  Doing it here is kind of a pain, but it works.
        if(footerItem != null) {
            footerItem["OtherPay"].Text = string.Format("{0:#,##0}", _otherPayTotal);
  2. Eyup
    Eyup avatar
    3322 posts

    Posted 02 Apr 2013 Link to this post

    Hello Kevin,

    RadGrid adds the name of the Aggregate function by default. You can use the following property to customize it:
    <telerik:GridTemplateColumn ... Aggregate="Custom" FooterAggregateFormatString="{0}">

    Hope this helps. Please give it a try and let me know if it works for you.

    the Telerik team
    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 their blog feed now.
Back to Top