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

Change Group By Header text

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 11 Aug 2014, 03:06 PM
In the header of my group by, I have the text and direction of sort of the column being grouped by.

http://i.imgur.com/VEUtVC9.png is an image of what I have now.

Instead of DateAdded I would like to be able to change it to something else.

Is there a way to do this? I have been googling around and haven't found much of anything at all.

Any help/guidance is appreciated!

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 12 Aug 2014, 09:49 AM
Hi Alexander,

Please try the following code snippet to change group header text.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    foreach (TableCell cell in RadGrid1.GroupPanel.GroupPanelItems)
    {
        foreach (Control ctrl in cell.Controls)
        {
            if (ctrl is Literal)
            {
                Literal columnText = ctrl as Literal;
                string name=columnText.Text.Replace(" ",string.Empty);
                if (name == "DateAdded ")
                {
                  columnText.Text = "Custom Text";
                }
            }
        }
    }
}

Thanks,
Princy
0
Alexander
Top achievements
Rank 1
answered on 12 Aug 2014, 01:36 PM
Thank you very much Princy! Works perfectly.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Alexander
Top achievements
Rank 1
Share this question
or