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

RadGrid aligning Items under column name in GroupHeader

1 Answer 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
IMF
Top achievements
Rank 1
IMF asked on 27 Feb 2015, 11:19 AM
Hello,

I have a radGrid that populates with groups. The group header displays the group header title and aggregate sum as expected but the group header text is not aligned under the column name. All the header text is aligned in the left side of the groupheader. My code for calculates the sum is this:

protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            RadGrid1.HeaderStyle.Font.Size = 10;
            RadGrid1.GroupHeaderItemStyle.Font.Size = 10; 
  
            GridGroupByExpression gridGroupByExpression1 = new GridGroupByExpression();
            GridGroupByField gridGroupByField1 = new GridGroupByField();
              
            gridGroupByField1.FieldName = "GroupName";
            gridGroupByField1.HeaderValueSeparator = " ";
  
            gridGroupByExpression1.SelectFields.Add(gridGroupByField1);
            gridGroupByExpression1.GroupByFields.Add(gridGroupByField1);
  
            GridGroupByField gridGroupByField3 = new GridGroupByField();
              
            foreach (totals tot in totalsList)
            {
                gridGroupByField3 = new GridGroupByField();
                gridGroupByField3.FieldName = tot.name;
                gridGroupByField3.HeaderText = " ";
                gridGroupByField3.HeaderValueSeparator = " ";
                gridGroupByField3.FormatString = " (Total: {0})";
                gridGroupByField3.Aggregate = GridAggregateFunction.Sum;
                gridGroupByExpression1.SelectFields.Add(gridGroupByField3);
            }
  
            RadGrid1.MasterTableView.GroupByExpressions.Add(gridGroupByExpression1);
        }

I need to align the sum under the column name inside the groupheader text.

Thank you

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 04 Mar 2015, 09:26 AM
Hello,

The aggregate values will be aligned under the corresponding header cells of the columns only when they are displayed in the footer. You could see such layout in the following online demo:
As for the group header, the structure of the GridGroupHeader is not designed to be aligned with the corresponding columns and the only way for achieving the requirement that you have would be to create a GroupHeaderTemplate with the layout that you need, but since this a template, it should be handled by the developer.

Detailed information on the GroupHeaderTemplate could be found in the following help article:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
IMF
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or