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

HTML like formatting in a group header row

4 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kaddy
Top achievements
Rank 1
kaddy asked on 31 Aug 2011, 09:30 PM
Hi,

Is it possible to do any HTML like formatting in a group header row?  I'm currently changing the header in GroupSummaryEvaluate event right now.

Thanks!



4 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 02 Sep 2011, 02:04 PM
Hi Kaddy,

Yes, this is possible. You should replace the default content cell in the group header row with a custom one by inheriting from GridGroupContentCellElement. Use the CreateCell event to replace the cell:
void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridGroupContentCellElement))
    {
        e.CellType = typeof(MyGroupCell);
    }
}
 
public class MyGroupCell : GridGroupContentCellElement
{
    public MyGroupCell(GridViewColumn column, GridRowElement row)
        : base(column, row)
    {
    }
 
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GridGroupContentCellElement);
        }
    }
    public override void SetContent()
    {
        this.DisableHTMLRendering = false;
        this.Text = "<html><b>" + this.Value;
    }
}

I hope this helps.

Best wishes,
Jack
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
kaddy
Top achievements
Rank 1
answered on 02 Sep 2011, 07:50 PM
Thanks, that's just what we needed.
0
Stefan
Telerik team
answered on 03 Sep 2011, 06:23 AM
Hi Kaddy,

I am glad that I could help. Should you have any other questions, do not hesitate to contact us.

Greetings,
Stefan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Christ
Top achievements
Rank 2
answered on 05 Sep 2011, 07:44 AM
Hi Stefan,

Tried it out and it works! I will go play a little bit with it now.

Thanks,
Christ
Tags
GridView
Asked by
kaddy
Top achievements
Rank 1
Answers by
Jack
Telerik team
kaddy
Top achievements
Rank 1
Stefan
Telerik team
Christ
Top achievements
Rank 2
Share this question
or