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

[Solved] Grouping Totals displaying incorrectly

12 Answers 361 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 02 Dec 2008, 04:29 PM
I just noticed that in a grid I have been working on is displaying group aggregate totals incorrectly. This occurs any time I group more than one column together.

Here is a link displaying the problem: Grouping Problem.

Here is the relevant aspx code for the grouping:
                <telerik:RadGrid ID="CurrentCostCentersGrid" runat="server" Skin="Vista" AllowMultiRowSelection="True" 
                    AllowMultiRowEdit="True" AllowFilteringByColumn="false" ShowGroupPanel="True" 
                    AllowPaging="True" DataSourceID="DataSourceUnits" GridLines="Horizontal" AutoGenerateColumns="False" 
                    PageSize="50" ShowFooter="true" Width="100%">  
                    <ClientSettings AllowDragToGroup="true" AllowGroupExpandCollapse="true" AllowColumnsReorder="false" 
                        AllowExpandCollapse="true" AllowColumnHide="true">  
                        <Selecting AllowRowSelect="true" /> 
                        <ClientEvents OnRowSelected="CostCenterSelected" OnRowDeselected="CostCenterUnselected" 
                            OnRowSelecting="checkValidRowTarget" OnRowDeselecting="checkValidRowTarget" /> 
                    </ClientSettings> 
                    <GroupPanel Enabled="true" Text="Groups">  
                    </GroupPanel> 
                    <PagerStyle Mode="NextPrevAndNumeric" NextPageText="Next" PrevPageText="Previous" /> 
                    <MasterTableView ShowGroupFooter="true" ShowFooter="true" DataSourceID="DataSourceUnits" 
                        DataKeyNames="CostCenterItemID" CommandItemDisplay="None" ClientDataKeyNames="CostCenterItemID">  
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px"></HeaderStyle> 
                            <ItemStyle VerticalAlign="Top" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn Visible="False" UniqueName="ExpandColumn">  
                            <HeaderStyle Width="20px"></HeaderStyle> 
                            <ItemStyle VerticalAlign="Top" /> 
                        </ExpandCollapseColumn> 
                        <Columns> 
                            <telerik:GridTemplateColumn UniqueName="StatusIcon" Groupable="false" DataField="StatusName">  
                                <ItemTemplate> 
                                    <asp:Image ID="StatusIcon" runat="server" ImageUrl='<%# "./images/statusicons/" + Eval("ImageName") + ".png" %>' 
                                        AlternateText='<%#Eval("StatusName") %>' /> 
                                </ItemTemplate> 
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" /> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridClientSelectColumn UniqueName="ClientSideSelect">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" /> 
                            </telerik:GridClientSelectColumn> 
                            <telerik:GridBoundColumn Display="false" DataField="StatusID" UniqueName="StatusID" /> 
                            <telerik:GridBoundColumn HeaderText="Fund" DataField="FundID" AllowFiltering="true" 
                                DataType="System.Int32" SortExpression="FundID" ReadOnly="True" UniqueName="FundID">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Unit" DataField="UnitID" AllowFiltering="true" 
                                DataType="System.Int32" SortExpression="UnitID" ReadOnly="True" UniqueName="UnitID">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Object" DataField="LineItemID" AllowFiltering="true" 
                                DataType="System.Int32" SortExpression="LineItemID" ReadOnly="True" UniqueName="LineItemID">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Description" DataField="LineItemName" SortExpression="LineItemName" 
                                UniqueName="Description" ReadOnly="true" Groupable="false">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Left" Wrap="true" Width="150px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Prev Budget" DataField="PreviousBudget" AllowFiltering="true" 
                                DataType="System.Decimal" SortExpression="PreviousBudget" UniqueName="PreviousBudget" 
                                DataFormatString="{0:C}" ReadOnly="True" Aggregate="Sum" FooterAggregateFormatString="{0:C}" 
                                Groupable="false" Display="false">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" Width="100px" /> 
                                <FooterStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Prev Actual" DataField="PreviousActual" DataType="System.Decimal" 
                                SortExpression="PreviousActual" UniqueName="PreviousActual" DataFormatString="{0:C}" 
                                Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}" Display="false">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" Width="100px" /> 
                                <FooterStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Current Budget" DataField="CurrentBudget" DataType="System.Decimal" 
                                SortExpression="CurrentBudget" UniqueName="CurrentBudget" DataFormatString="{0:C}" 
                                Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" Width="100px" /> 
                                <FooterStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="YTD" DataField="CurrentYTD" DataType="System.Decimal" 
                                SortExpression="CurrentYTD" UniqueName="CurrentYTD" DataFormatString="{0:C}" 
                                Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" Width="100px" /> 
                                <FooterStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Proposed" DataField="ProposedBudget" DataType="System.Decimal" 
                                SortExpression="ProposedBudget" UniqueName="ProposedBudget" Groupable="false" 
                                Aggregate="Sum" FooterAggregateFormatString="{0:C}" DataFormatString="{0:C}">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" Width="100px" /> 
                                <FooterStyle VerticalAlign="Top" HorizontalAlign="Right" Wrap="false" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Category" EmptyDataText="&amp;nbsp;" HeaderText="Category" 
                                SortExpression="Category" UniqueName="Category">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Left" Wrap="false" Width="115px" 
                                    Font-Size="10px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Group" EmptyDataText="&amp;nbsp;" HeaderText="Group" 
                                SortExpression="Group" UniqueName="Group">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Left" Wrap="false" Width="100px" 
                                    Font-Size="10px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridTemplateColumn HeaderText="Modified" DataField="ModifyDate" UniqueName="Modified" 
                                Groupable="false">  
                                <ItemTemplate> 
                                    <strong> 
                                        <%#Eval("ModifyBy")%></strong><br /> 
                                    <%#Eval("ModifyDate")%> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="Imported" DataField="DateLastImported" UniqueName="ImportDate" 
                                Groupable="false">  
                                <ItemTemplate> 
                                    <img src="Images/Button-Refresh-16x16.png" alt="Imported at <%#Eval("LastImportDate") %>" /> 
                                </ItemTemplate> 
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" /> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="Images/graph1_16x16.gif" 
                                CommandName="GraphCostCenter" Groupable="false" UniqueName="GraphCurrentYTD" 
                                Text="Graph YTD Spending">  
                                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" /> 
                            </telerik:GridButtonColumn> 
                        </Columns> 
                        <DetailTables> 
                            <telerik:GridTableView DataSourceID="DataSourceHistory" AutoGenerateColumns="false" 
                                ShowHeader="false" GroupsDefaultExpanded="false" NoDetailRecordsText="No notes currently exist for this item" 
                                Width="100%" CommandItemDisplay="Top" Frame="Void" Name="RequestHistory" DataKeyNames="HistoryID">  
                                <CommandItemTemplate> 
                                    <telerik:RadToolBar ID="DetailsToolbar" runat="server" Skin="Vista" Width="100%" 
                                        AutoPostBack="true" OnClientLoad="SetNestedToolbar">  
                                        <ExpandAnimation Type="OutQuad" Duration="150" /> 
                                        <CollapseAnimation Type="InQuad" Duration="150" /> 
                                        <Items> 
                                            <telerik:RadToolBarButton Text="Make Request" CommandName="MakeRequest" ImageUrl="Images/request.gif">  
                                            </telerik:RadToolBarButton> 
                                            <telerik:RadToolBarButton IsSeparator="true">  
                                            </telerik:RadToolBarButton> 
                                            <telerik:RadToolBarButton Text="Approval" CommandName="ApproveRequest">  
                                            </telerik:RadToolBarButton> 
                                        </Items> 
                                    </telerik:RadToolBar> 
                                </CommandItemTemplate> 
                                <ParentTableRelation> 
                                    <telerik:GridRelationFields MasterKeyField="CostCenterItemID" DetailKeyField="ItemID" /> 
                                </ParentTableRelation> 
                                <RowIndicatorColumn> 
                                    <HeaderStyle Width="20px"></HeaderStyle> 
                                    <ItemStyle VerticalAlign="Top" /> 
                                </RowIndicatorColumn> 
                                <ExpandCollapseColumn> 
                                    <HeaderStyle Width="20px"></HeaderStyle> 
                                    <ItemStyle VerticalAlign="Top" /> 
                                </ExpandCollapseColumn> 
                                <Columns> 
                                    <telerik:GridTemplateColumn UniqueName="History">  
                                        <ItemTemplate> 
                                            <strong> 
                                                <%#Eval("CreateDate","{0:d}") %>&nbsp;<%#Eval("CreateDate","{0:t}") %>&nbsp;-&nbsp;<%#Eval("UserName")%>:</strong>&nbsp;<br /> 
                                            <strong>Status:</strong> 
                                            <asp:Image ID="OldStatusIcon" runat="server" /><img src="Images/right.gif" alt="to" /><asp:Image  
                                                ID="NewStatusIcon" runat="server" /> 
                                            <style="margin-top: 3px; margin-bottom: 2px; margin-left: 15px;">  
                                                <%#Eval("NoteText")%></p>  
                                            <asp:Panel ID="RequestPanel" runat="server">  
                                                <strong style="color: Red">Amount Requested:</strong>&nbsp;  
                                                <%#Eval("RequestedBudget", "{0:C}")%></asp:Panel> 
                                            <hr /> 
                                        </ItemTemplate> 
                                    </telerik:GridTemplateColumn> 
                                </Columns> 
                            </telerik:GridTableView> 
                        </DetailTables> 
                        <PagerStyle Mode="NextPrevAndNumeric" /> 
                    </MasterTableView> 
                </telerik:RadGrid> 
 

And the code behind:
    Protected Sub InjectImages(ByVal source As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles CurrentCostCentersGrid.ItemDataBound  
        If e.Item.OwnerTableView.DataSourceID = "DataSourceHistory" Then 
            If e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then 
                Dim item As Telerik.Web.UI.GridDataItem = e.Item  
                Dim OldIcon As Image = item("History").FindControl("OldStatusIcon")  
                Dim NewIcon As Image = item("History").FindControl("NewStatusIcon")  
 
                Dim data As Southwestern.BudgetPortal.Data.CostCenter_GetNotesResult = item.DataItem  
 
                If data.IsManagementNote = True Then 
                    Dim RequestPanel As Panel = item("History").FindControl("RequestPanel")  
                    RequestPanel.Visible = False 
                End If 
 
                Dim OldStatus As Southwestern.BudgetPortal.Data.CostCenterStatus = (From S In Repository.CostCenterStatus Where S.StatusID = data.OldStatusID).Single()  
                Dim NewStatus As Southwestern.BudgetPortal.Data.CostCenterStatus = (From S In Repository.CostCenterStatus Where S.StatusID = data.StatusID).Single()  
 
                OldIcon.ImageUrl = "images/statusicons/" & OldStatus.ImageName & ".png" 
                OldIcon.AlternateText = "Old Status: " & OldStatus.StatusName  
 
                NewIcon.ImageUrl = "images/statusicons/" & NewStatus.ImageName & ".png" 
                NewIcon.AlternateText = "New Status: " & NewStatus.StatusName  
            End If 
        End If 
    End Sub 
 
    Protected Sub AllowCheckbox(ByVal source As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles CurrentCostCentersGrid.ItemDataBound  
        If e.Item.OwnerTableView.DataSourceID <> "DataSourceHistory" Then 
            If e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then 
                Dim user As Southwestern.BudgetPortal.Data.SystemUser = WebHelper.GetSystemUser()  
 
                If user.PortalAdministrator = False And user.SiteAdministrator = False Then 
                    ' Check permissions on the item. Checkboxes should only be enabled for manage rights.  
                    Dim item As Telerik.Web.UI.GridDataItem = e.Item  
                    Dim data As Southwestern.BudgetPortal.Data.CostCenter_GetAvailableUnitsResult = item.DataItem  
 
                    Dim unitRights As Southwestern.BudgetPortal.Data.UnitPermission = (From UP In Repository.UnitPermissions _  
                                                                                       Where UP.SamAccountName = user.SamAccountName _  
                                                                                       And UP.UnitID = data.UnitID).Single()  
 
                    Dim checkBox As CheckBox = CType(item("ClientSideSelect").Controls(0), CheckBox)  
                    If unitRights IsNot Nothing AndAlso unitRights.UnitManager = True Then 
                        checkBox.Enabled = True 
                    Else 
                        checkBox.Enabled = False 
                    End If 
                End If 
            ElseIf e.Item.ItemType = Telerik.Web.UI.GridItemType.Header Then 
                ' Hide the checkbox in the header if this user is not a portal administrator  
                Dim user As Southwestern.BudgetPortal.Data.SystemUser = WebHelper.GetSystemUser()  
 
                If user.PortalAdministrator = False And user.SiteAdministrator = False Then 
                    Dim item As Telerik.Web.UI.GridHeaderItem = e.Item  
                    Dim checkBox As CheckBox = CType(item("ClientSideSelect").Controls(0), CheckBox)  
                    checkBox.Visible = False 
                End If 
            End If 
        End If 
    End Sub 
 
    Protected Sub GreyOutReviewOnlyItems(ByVal source As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles CurrentCostCentersGrid.ItemDataBound  
        If e.Item.OwnerTableView.DataSourceID <> "DataSourceHistory" Then 
            If e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then 
                Dim data As Southwestern.BudgetPortal.Data.CostCenter_GetAvailableUnitsResult = e.Item.DataItem  
 
                If data.ReviewOnly = True Then 
                    For Each Cell As TableCell In e.Item.Cells  
                        Cell.ForeColor = Drawing.Color.Gray  
                        Cell.Font.Bold = True 
                        Cell.Font.Italic = True 
                        Cell.BackColor = Drawing.Color.FromArgb(200, 200, 200)  
                        Cell.BorderColor = Drawing.Color.FromArgb(200, 200, 200)  
                    Next 
                End If 
            End If 
        End If 
    End Sub 
 
    Protected Sub CurrentCostCentersGrid_DetailTableDataBind(ByVal source As ObjectByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles CurrentCostCentersGrid.DetailTableDataBind  
        Dim UnitID As Integer = e.DetailTableView.ParentItem.Item("UnitID").Text  
 
        Dim Manager As Boolean = False 
        Dim Write As Boolean = False 
 
        Dim User As Southwestern.BudgetPortal.Data.SystemUser = WebHelper.GetSystemUser()  
 
        If User.PortalAdministrator = True Or User.SiteAdministrator = True Then 
            Manager = True 
            Write = True 
        Else 
            Try 
                Manager = (From P As Southwestern.BudgetPortal.Data.UnitPermission In WebHelper.GetSystemUser().UnitPermissions Where P.UnitID = UnitID Select P.UnitManager).Single()  
                Write = (From P As Southwestern.BudgetPortal.Data.UnitPermission In WebHelper.GetSystemUser().UnitPermissions Where P.UnitID = UnitID Select P.Editor).Single()  
            Catch ex As Exception  
            End Try 
        End If 
 
        If User.PortalAdministrator = False And User.SiteAdministrator = False Then 
            Dim StatusIDText As String = e.DetailTableView.ParentItem.Item("StatusID").Text  
            Dim StatusID As Integer = 0  
            Dim LockItem As Boolean = True 
 
            If Integer.TryParse(StatusIDText, StatusID) Then 
                ' get the status item  
                Dim StatusEntry = (From Status In Repository.CostCenterStatus Where Status.StatusID = StatusID).Single()  
 
                If Write = True And Manager = False And StatusEntry.LocksCostCenter = True Then 
                    ' first condition, non-unit manager and cost center status indicates locked  
                    LockItem = True 
                ElseIf Manager = True Then 
                    ' second condition, unit manager  
                    If StatusEntry.UnitManagerSet = False And StatusEntry.PortalAdminSet = True And StatusEntry.LocksCostCenter = True Then 
                        ' portal administrator has locked it  
                        LockItem = True 
                    Else 
                        LockItem = False 
                    End If 
                ElseIf Write = False And Manager = False Then 
                    ' The user has read only access  
                    LockItem = True 
                Else 
                    LockItem = False 
                End If 
            End If 
 
            If LockItem = True Then 
                e.DetailTableView.CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None  
                Exit Sub 
            End If 
        End If 
 
        ' Currently hiding buttons client side  
        Dim Script As String = "canApprove={0};canEdit={1};Sys.Application.add_load(SetApprovalVisibility);Sys.Application.add_load(SetNestedToolbarVisibility);" 
        If Manager = True Then 
            Script = String.Format(Script, "true""true")  
        ElseIf Write = True Then 
            Script = String.Format(Script, "false""true")  
        Else 
            Script = String.Format(Script, "false""false")  
        End If 
        ScriptManager.RegisterStartupScript(Me, source.GetType(), "SetUnitToolbar", Script, True)  
 
    End Sub 
 
    Protected Sub CurrentCostCentersGrid_GroupsChanging(ByVal source As ObjectByVal e As Telerik.Web.UI.GridGroupsChangingEventArgs) Handles CurrentCostCentersGrid.GroupsChanging  
        ' Used to show/hide group by columns  
        Dim GroupByFieldName As String = e.Expression.GroupByFields(0).FieldName ' The unique name of the column  
        Dim GroupByColumn As Telerik.Web.UI.GridColumn = CurrentCostCentersGrid.MasterTableView.GetColumnSafe(GroupByFieldName) ' The actual column  
 
        If e.Action = Telerik.Web.UI.GridGroupsChangingAction.Group Then 
            ' We are grouping, so hide the column in the grid.  
            GroupByColumn.Visible = False 
        ElseIf e.Action = Telerik.Web.UI.GridGroupsChangingAction.Ungroup Then 
            ' We are ungrouping, so show the column again.  
            GroupByColumn.Visible = True 
        End If 
    End Sub 
 

Any clues to why this might be occuring would be very helpful!

Thanks!

12 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 03 Dec 2008, 04:24 PM
I'm experiencing the same issue with my application.  I've pared it down to a smaller code block.

Here's a screen shot of what I'm getting: Grid Image

I have three columns and three rows.  When I group on two columns, in this case Department and then Item, the Sum in the Quantity footer is incorrect.  These issues become more prevalent as I add columns and rows.

Please help!


ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridTest._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>Test Page</title> 
    </head> 
 
    <body> 
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
            <div> 
 
                <telerik:RadGrid ID="RadGrid1" runat="server">  
                      
                    <MasterTableView AutoGenerateColumns="false" EnableHeaderContextMenu="true"   
                            GroupLoadMode="Client" ShowGroupFooter="true">  
                      
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                          
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                          
                        <Columns> 
                              
                            <telerik:GridBoundColumn DataField="Department" HeaderText="Department" 
                                    Aggregate="CountDistinct" FooterText="Departments: " /> 
                              
                            <telerik:GridBoundColumn DataField="Item" HeaderText="Item" 
                                    Aggregate="CountDistinct" FooterText="Items: " /> 
                                      
                            <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" 
                                    Aggregate="Sum" FooterText="Total: " /> 
                              
                        </Columns> 
                          
                    </MasterTableView> 
                  
                </telerik:RadGrid> 
 
            </div> 
        </form> 
    </body> 
 
</html> 
 

C#
protected void Page_Load(object sender, EventArgs e)  
{  
 
    // create data set  
 
    DataTable table = new DataTable();  
 
    table.Columns.Add("Department"typeof(string));  
    table.Columns.Add("Item"typeof(string));  
    table.Columns.Add("Quantity"typeof(int));  
 
 
    // add row one  
 
    DataRow row = table.NewRow();  
 
    row["Department"] = "Produce";  
    row["Item"] = "Apples";  
    row["Quantity"] = 10;  
 
    table.Rows.Add(row);  
 
 
    // add row two  
 
    row = table.NewRow();  
 
    row["Department"] = "Produce";  
    row["Item"] = "Oranges";  
    row["Quantity"] = 3;  
 
    table.Rows.Add(row);  
 
 
    // add row three  
 
    row = table.NewRow();  
 
    row["Department"] = "Produce";  
    row["Item"] = "Oranges";  
    row["Quantity"] = 4;  
 
    table.Rows.Add(row);  
 
 
    // bind  
 
    RadGrid1.DataSource = table.DefaultView;  
    RadGrid1.DataBind();  
 
0
Chris
Top achievements
Rank 1
answered on 03 Dec 2008, 05:16 PM
BTW, I forgot to mention that I'm using the Q2 build of the ASP.NET AJAX controls (2008.2.1001.35).

Thanks for any assistance!
0
Iana Tsolova
Telerik team
answered on 05 Dec 2008, 10:17 AM
Hello Chris,

Unfortunately it is a known issue that grid footer aggregates are not calculated properly when grid is grouped by more than one fields. We are working on this issue already and I hope a resolution to be found soon.

Please excuse us for the inconvenience.

Greetings,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris
Top achievements
Rank 1
answered on 05 Dec 2008, 03:04 PM
Iana,

Thank you for the update. I will be looking forward to the resolution.

Thanks!
Chris
0
EBS
Top achievements
Rank 1
answered on 26 Jan 2009, 01:57 PM
I'm not sure if this is the same issue: I have a grid with detail tables nested by a parent relation.  All detail tables are showing the "top-level" aggregates (all the same numbers), not the aggregate for the specific level.  I am using ShowGroupFooter for this.  ...any suggestions?

<telerik:RadGrid ID="grd_sector"   
    runat="server" 
    ShowStatusBar="false"   
    ShowGroupPanel="false" 
    ShowFooter="True"   
    AllowPaging="False"   
    AllowSorting="True" 
    AutoGenerateColumns="false" 
    AllowMultiRowSelection="False"   
    GridLines="None"   
    Skin="WebBlue">  
    <MasterTableView DataKeyNames="sector_name" Name="sector" HierarchyLoadMode="Client" ShowGroupFooter="true">  
        <Columns> 
            <telerik:GridBoundColumn DataField="sector_name" HeaderText="DOMESTIC EQUITIES" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" FooterStyle-HorizontalAlign="Left" Aggregate="None" FooterText="TOTAL EQUITIES" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="TotalCost" HeaderText="Tax Cost" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="TotalMarket" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Pct_Assets" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="AnnualIncome" HeaderText="Projected Annual Income" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C0}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Yield" HeaderText="Yield" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="None" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
        </Columns> 
        <DetailTables> 
            <telerik:GridTableView DataKeyNames="industry_name" Name="industry" HierarchyLoadMode="Client" ShowGroupFooter="true">  
                <ParentTableRelation> 
                    <telerik:GridRelationFields DetailKeyField="sector_name" MasterKeyField="sector_name" /> 
                </ParentTableRelation> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="sector_name" Visible="false"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="industry_name" HeaderText="INDUSTRY" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" FooterStyle-HorizontalAlign="Left" Aggregate="None" FooterText="TOTAL" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="TotalCost" HeaderText="Tax Cost" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="TotalMarket" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Pct_Assets" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="AnnualIncome" HeaderText="Projected Annual Income" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C0}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Yield" HeaderText="Yield" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="none" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                </Columns> 
                <DetailTables> 
                    <telerik:GridTableView Name="security" ShowGroupFooter="true">  
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="industry_name" MasterKeyField="industry_name" /> 
                        </ParentTableRelation> 
                        <Columns> 
                            <telerik:GridBoundColumn DataField="industry_name" Visible="false"></telerik:GridBoundColumn> 
                            <telerik:GridTemplateColumn UniqueName="TemplateSecurity" ItemStyle-CssClass="hovercursor" HeaderText="SECURITY">  
                                <ItemTemplate> 
                                    <asp:Label ID="lbl_security" runat="server" Font-Underline="true" ForeColor="#002868" Text="Security"></asp:Label> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridBoundColumn DataField="Security" Visible="false"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="TotalCost" HeaderText="Tax Cost" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="None" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="TotalMarket" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Pct_Assets" HeaderText="Market Value" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="AnnualIncome" HeaderText="Projected Annual Income" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:C0}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Yield" HeaderText="Yield" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" Aggregate="Sum" DataFormatString="{0:P2}" FooterStyle-Font-Bold="true"></telerik:GridBoundColumn> 
                        </Columns> 
                    </telerik:GridTableView> 
                </DetailTables> 
            </telerik:GridTableView> 
        </DetailTables> 
        <NoRecordsTemplate> 
            No data is available.  
        </NoRecordsTemplate> 
    </MasterTableView> 
</telerik:RadGrid> 

Protected Sub grd_sector_NeedDataSource(ByVal source As ObjectByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grd_sector.NeedDataSource  
     If ds IsNot Nothing AndAlso DataTools.IsValidDatatable(ds.Tables(0)) Then 
         grd_sector.DataSource = ds.Tables(1)  
     End If 
End Sub 
 
Protected Sub grd_sector_DetailTableDataBind(ByVal source As ObjectByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles grd_sector.DetailTableDataBind  
     Select Case e.DetailTableView.Name  
         Case "industry" 
             e.DetailTableView.DataSource = ds.Tables(2)  
         Case "security" 
             e.DetailTableView.DataSource = ds.Tables(3)  
     End Select 
End Sub 
0
Iana Tsolova
Telerik team
answered on 27 Jan 2009, 06:44 AM
Hello,

Could you please prepare a runnable sample illustrating the issue and send it to us (in a formal support ticket)? Thus I could investigate the problem you are facing in depth a try providing a resolution for you.

Looking forward your reply,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Joseph
Top achievements
Rank 2
answered on 28 Apr 2009, 10:54 PM
Hello,

I am having the same problem with the columns not calculating correctly. Has a patch been released that fixes this issue? I am using Rad Controls ASPNET AJAX Q3 2008 (I think it is v2008.3.1016.35).

Thanks,
Joe
0
Iana Tsolova
Telerik team
answered on 29 Apr 2009, 02:36 PM
Hello Joseph,

Please try getting the latest internal build of the controls from the "Internal Builds" link in your Telerik account. The issue with the nested groups totals is fixed there.

Let me know how it goes.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Joseph
Top achievements
Rank 2
answered on 29 Apr 2009, 04:37 PM
Hi Iana,

Thanks for the reply. I have purchased the Q1 2009 last night and have added the updated Telerk.Web.UI.dll to my project, but the calculation are still off. (The new skins look great!). In the grouping, it seem to not add the first row of data in each group to the totals.

Thanks,
Joe
0
Joseph
Top achievements
Rank 2
answered on 29 Apr 2009, 04:41 PM
I just found the hotfix download. I am downloading now and will apply and will let you know the result.

Thanks,
Joe
0
Joseph
Top achievements
Rank 2
answered on 29 Apr 2009, 04:47 PM
The hotfix worked, and it is totaling correctly!
0
Iana Tsolova
Telerik team
answered on 30 Apr 2009, 06:29 AM
Hello Joseph,

I am glad to hear you liked the controls new Skins look and that the hotfix solved the issues you were facing.

Do any questions arise, feel free to contact us again.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Chris
Top achievements
Rank 1
Iana Tsolova
Telerik team
EBS
Top achievements
Rank 1
Joseph
Top achievements
Rank 2
Share this question
or