GroupAggregate using 3 Fields Aggregate Custom C1GridView 2025v2 399

Posted by: enrique.pv-ext on 2 July 2026, 6:49 am EST

    • Post Options:
    • Link

    Posted 2 July 2026, 6:49 am EST

    Hi,

    Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.

    Using C1GridView from C1.Web.Wijmo.Controls.48.dll

    Legacy code ongroupaggregate server:

              <%--            ongroupaggregate="VoucherBreakDownGrid_GroupAggregate"
              --%>
                    <cc1:C1GridView
                        ID="VoucherBreakDownGrid" runat="server"
                        AutogenerateColumns="false"
                        DataKeyNames="VEHICLETYPEID, ISSUERID, RATEID" Width="900px">
                        <Columns>
                            <cc1:C1TemplateField Visible="false">
                                <GroupInfo FooterText="Total:" Position="Footer" GroupSingleRow="true">
                                    <%--            <FooterStyle BackColor="#0050A6" ForeColor="White" Font-Bold="True" />
                <HeaderStyle BackColor="#0050A6" />--%>
                                </GroupInfo>
                                <ItemStyle Width="0px" />
                            </cc1:C1TemplateField>
                            <cc1:C1BoundField DataField="VEHICLETYPE" HeaderText="Tipo vehículo">
                                <ItemStyle HorizontalAlign="Left" />
                            </cc1:C1BoundField>
                            <cc1:C1BoundField DataField="ISSUER" HeaderText="Emisor cupones">
                                <ItemStyle HorizontalAlign="Left" />
                            </cc1:C1BoundField>
                            <cc1:C1BoundField DataField="RATE" HeaderText="Tarifa">
                                <ItemStyle HorizontalAlign="Left" />
                            </cc1:C1BoundField>
                            <cc1:C1BoundField DataField="VOUCHERNUMBER" HeaderText="Número de cupones" Aggregate="Custom">
                                <ItemStyle HorizontalAlign="Center" />
                            </cc1:C1BoundField>
                            <cc1:C1BoundField DataField="UNITAMOUNT" HeaderText="Importe unitario" DataFormatString="c0" Aggregate="Custom">
                                <ItemStyle HorizontalAlign="Right" />
                            </cc1:C1BoundField>
                            <cc1:C1BoundField DataField="TOTALAMOUNT" HeaderText="Total" DataFormatString="c0" Aggregate="Custom">
                                <ItemStyle HorizontalAlign="Right" />
                            </cc1:C1BoundField>
                        </Columns>
                    </cc1:C1GridView>
    

    event in server legacy

            //protected void VoucherBreakDownGrid_GroupAggregate(object sender, C1.Web.UI.Controls.C1GridView.C1GroupTextEventArgs e)
            //{
            //    decimal sum = 0;
    
            //    for (int i = e.StartItemIndex; i <= e.EndItemIndex; i++)
            //    {
            //        string s = string.Empty;
    
            //        if (((C1BoundField)(e.Col)).DataField == "VOUCHERNUMBER")
            //        {
            //            s = ((C1GridView)sender).Rows[i].Cells[4].Text;
            //        }
            //        else if (((C1BoundField)(e.Col)).DataField == "UNITAMOUNT")
            //        {
            //            s = ((C1GridView)sender).Rows[i].Cells[5].Text;
            //        }
            //        else if (((C1BoundField)(e.Col)).DataField == "TOTALAMOUNT")
            //        {
            //            s = ((C1GridView)sender).Rows[i].Cells[6].Text;
            //        }
    
            //        decimal val = 0;
            //        decimal.TryParse(s, System.Globalization.NumberStyles.Any, null, out val);
            //        sum += val;
            //    }
    
            //    if (((C1BoundField)(e.Col)).DataField == "VOUCHERNUMBER")
            //    {
            //        e.Text = string.Format("{0:0}", sum);
            //    }
            //    else if (((C1BoundField)(e.Col)).DataField == "UNITAMOUNT")
            //    {
            //        e.Text = string.Format("{0:C}", sum);
            //    }
            //    else if (((C1BoundField)(e.Col)).DataField == "TOTALAMOUNT")
            //    {
            //        e.Text = string.Format("{0:C}", sum);
            //    }
            //}
    

    any suggestions about it migrate GroupAggregate ?

    thanks a lot

  • Posted 3 July 2026, 3:30 am EST

    Hi,

    The latest version of C1GridView internally handles aggregates in the group headers. Therefore, instead of handling any events, you can simply set the Aggregate property of the C1BoundField to Sum. This eliminates the extra code required to calculate the sum manually.

    <cc1:C1BoundField DataField="VOUCHERNUMBER" HeaderText="Número de cupones" Aggregate="Sum">
        <ItemStyle HorizontalAlign="Center" />
    </cc1:C1BoundField>
    <cc1:C1BoundField DataField="UNITAMOUNT" HeaderText="Importe unitario" DataFormatString="c0" Aggregate="Sum">
         <ItemStyle HorizontalAlign="Right" />
    </cc1:C1BoundField>
    <cc1:C1BoundField DataField="TOTALAMOUNT" HeaderText="Total" DataFormatString="c0" Aggregate="Sum">
        <ItemStyle HorizontalAlign="Right" />
    </cc1:C1BoundField>

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels