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

Rad Grid Grouping total's and sub total's

4 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rhys
Top achievements
Rank 1
Rhys asked on 06 Apr 2009, 02:20 PM

Hi All,

I am not sure if I am pushing the limits of RadGrid here, but below is the code that I am using.

I am trying to do is group the data in the RadGrid by Entity and then by Location, this I have achieved.  I would also like to have a sub total per location and then a total per entity.

As I said I get the grouping right, I also get the total by location right, but what seems to be is happening is that total per Entity seems to be the last amount in the location.

Firstly, can I achieve what I am trying to and secondly how.

Thanx

<telerik:RadGrid ID="RadGridMonthlyReport" runat="server" AllowFilteringByColumn="True"  
                    AllowSorting="True" DataSourceID="objDsMonthlyBillingReportAll"   
                    GridLines="None" Skin="Vista" HorizontalAlign="Left">  
    <HeaderContextMenu> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    </HeaderContextMenu> 
    <ExportSettings OpenInNewWindow="True" ExportOnlyData="True" /> 
 
    <MasterTableView ShowGroupFooter="true" AutoGenerateColumns="False" DataSourceID="">  
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
        <Columns> 
            <telerik:GridBoundColumn DataField="EntityNumber" HeaderText="Entity" SortExpression="EntityNumber" UniqueName="EntityNumber" /> 
            <telerik:GridBoundColumn DataField="LocationName" HeaderText="Department" SortExpression="LocationName" UniqueName="LocationName" /> 
            <telerik:GridBoundColumn DataField="ItemName" HeaderText="Item" SortExpression="ItemName" UniqueName="ItemName" /> 
            <telerik:GridBoundColumn DataField="Total" DataType="System.Decimal" HeaderText="Total" ReadOnly="True" SortExpression="Total" UniqueName="Total" Aggregate="Sum" FooterText="Total: " /> 
        </Columns> 
        <GroupByExpressions>      
            <telerik:GridGroupByExpression> 
                <GroupByFields> 
                    <telerik:GridGroupByField FieldName="EntityNumber" /> 
                </GroupByFields> 
                <SelectFields> 
                    <telerik:GridGroupByField FieldName="EntityNumber" HeaderText="Entity Number" /> 
                </SelectFields> 
            </telerik:GridGroupByExpression> 
            <telerik:GridGroupByExpression> 
                <GroupByFields> 
                    <telerik:GridGroupByField FieldName="LocationName" /> 
                </GroupByFields> 
                <SelectFields> 
                    <telerik:GridGroupByField FieldName="LocationName" HeaderText="Location Name" /> 
                </SelectFields> 
            </telerik:GridGroupByExpression>              
        </GroupByExpressions> 
    </MasterTableView> 
    <FilterMenu> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    </FilterMenu> 
</telerik:RadGrid> 

4 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 08 Apr 2009, 02:20 PM
Hi Rhys,

This is a known issue with RadGrid's calculation of aggregate values when more than one grouping level is present. Our development team has taken over the commitment to fix it.

Thank you for your understanding.

Greetings,
Tsvetoslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Rhys
Top achievements
Rank 1
answered on 08 Apr 2009, 02:31 PM
Thank you Tsvetoslav
0
John
Top achievements
Rank 1
answered on 05 Jun 2013, 01:19 PM
Hi, just wondering what the status is of this enhancement. Has it been implemented? Thanks
0
Princy
Top achievements
Rank 2
answered on 06 Jun 2013, 06:15 AM
Hi,

Yes,this has been implemented,here is a small example,not sure if this is what you want.

ASPX:
<telerik:RadGrid ID="Radgrid1" runat="server" AllowFilteringByColumn="True" AllowSorting="True"
    DataSourceID="SqlDataSource1" AllowPaging="true" GridLines="None" Skin="Vista"
    HorizontalAlign="Left">
    <HeaderContextMenu>
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
    </HeaderContextMenu>
    <MasterTableView ShowGroupFooter="true" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" SortExpression="OrderID"
                UniqueName="OrderID" />
            <telerik:GridBoundColumn DataField="OrderDate" HeaderText="OrderDate" SortExpression="OrderDate"
                UniqueName="OrderDate" />
            <telerik:GridBoundColumn DataField="ShipPostalCode" HeaderText="ShipPostalCode" SortExpression="ShipPostalCode"
                UniqueName="ShipPostalCode" />
            <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" ReadOnly="True"
                SortExpression="EmployeeID" UniqueName="EmployeeID" Aggregate="Sum" FooterText="Total: " />
        </Columns>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="EmployeeID" />
                </GroupByFields>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="EmployeeID" HeaderText="EmployeeID" />
                </SelectFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="OrderDate" />
                </GroupByFields>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="OrderDate" HeaderText="OrderDate" />
                </SelectFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
    <FilterMenu>
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
    </FilterMenu>
</telerik:RadGrid>

Thanks
Princy
Tags
Grid
Asked by
Rhys
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Rhys
Top achievements
Rank 1
John
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or