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

[Solved] How to get groupfooter on autogenerated column

1 Answer 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lachlan opray
Top achievements
Rank 1
lachlan opray asked on 01 Jul 2008, 06:55 AM
Hi, I am just using Radgrid with dynamic datasource but I want to show the groupfooter on each datarow. I tried to set the porperty like below:
         for (int i = 2; i < this.RadGrid.MasterTableView.AutoGeneratedColumns.Length; i++)  
          {  
             GridBoundColumn col = this.RadGrid.MasterTableView.AutoGeneratedColumns[i] as GridBoundColumn;  
           col.Aggregate = GridAggregateFunction.Sum;  
       }  
 
aspx code like:
            <Telerik:RadGrid ID="RadGrid" runat="server" AllowPaging="True" AllowSorting="True"   
                GridLines="None" Height="500px" OnNeedDataSource="RadGrid_NeedDataSource" ShowFooter="false" 
                ShowGroupPanel="false" PageSize="50" Width="100%" Visible="false">  
                <ClientSettings> 
                    <Scrolling AllowScroll="True" FrozenColumnsCount="2" UseStaticHeaders="True" /> 
                </ClientSettings> 
                <MasterTableView ShowGroupFooter="true" GroupLoadMode="Client" TableLayout="Auto">  
                    <GroupByExpressions> 
                        <Telerik:GridGroupByExpression> 
                            <GroupByFields> 
                                <Telerik:GridGroupByField FieldName="Group" FieldAlias="Group" HeaderText="Group" /> 
                            </GroupByFields> 
                            <SelectFields> 
                                <Telerik:GridGroupByField FieldName="Group" FieldAlias="Group" HeaderText="Group" /> 
                            </SelectFields> 
                        </Telerik:GridGroupByExpression> 
                    </GroupByExpressions> 
                    <RowIndicatorColumn Visible="False">  
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Resizable="False" Visible="False">  
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <EditFormSettings> 
                        <PopUpSettings ScrollBars="None" /> 
                    </EditFormSettings> 
                </MasterTableView> 
                <HeaderStyle Width="100px" /> 
            </Telerik:RadGrid> 
 
but it does not work .Actually can I set the aggregate property to the autogenerated columns?
Thanks!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Jul 2008, 07:41 AM
Hi Lachlan opray,

Try setting the Aggregate property for the AutoGeneratedColumn in the ColumnCreated event as shown below.

CS:
  protected void RadGrid3_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
    { 
        
        if (e.Column is GridBoundColumn) 
        { 
            GridBoundColumn col = (GridBoundColumn)e.Column; 
            col.Aggregate = GridAggregateFunction.Sum; 
        } 
    } 


Thanks
Shinu.
Tags
Grid
Asked by
lachlan opray
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or