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

[Solved] Grouping Header Text change

4 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Milan Gurung
Top achievements
Rank 1
Milan Gurung asked on 09 Jul 2009, 11:40 AM
Hi,

How can I change the grouping field text during runtime? To clarify the scenario, let's say the grid looks like this

ColA  ColB
1 2
3 4
2 5
....
From the program column names are changed and it looks like:

Column A     Column B
1 2
3 4
2 5

This is fine. The trouble comes when "Column A" is dragged for grouping. Grouping is done perfectly. The only concern I have is it is diplaying Grouping Field name as "ColA" rather than "Column A"

Can it be changed programmatically?

Any hint is deeply appreciated.

Thanks lot.

Milan G

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Jul 2009, 12:47 PM
Hello Milan,

You can access the groupheader row and thereby change the text to some custom text. This is explained in detail in the following help document:
Customizing GridGroupHeaderItem

Thanks
Princy.
0
Milan Gurung
Top achievements
Rank 1
answered on 09 Jul 2009, 01:05 PM
Hi Princy,

Thanks for the reply but I was looking for a way to change the text of the grouping header text which gets displayed on the top of the grid - on the grouping panel itself.

Thanks a lot.
Milan G
0
Shinu
Top achievements
Rank 2
answered on 10 Jul 2009, 07:41 AM
Hi Milan,

I tried the following code snippet change the grouping header text in the Group panel.

CS:
 
  protected void RadGrid2_PreRender(object sender, EventArgs e) 
    { 
        GridGroupPanel panel = (GridGroupPanel)RadGrid2.GroupPanel; 
        if (panel.GroupPanelItems.Count > 0) 
        { 
            Literal literal = (Literal)panel.GroupPanelItems[0].Controls[0]; 
            if(literal.Text.Contains("ProductName")) 
                literal.Text = "CustomText"
        } 
    } 


Thanks
Shinu
0
Milan Gurung
Top achievements
Rank 1
answered on 10 Jul 2009, 04:24 PM
Many thanks for the solution. I changed column name instead in the dataset itself.

Milan G
Tags
Grid
Asked by
Milan Gurung
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Milan Gurung
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or