HTML like formatting in a group header row

5 posts, 0 answers
  1. kaddy
    kaddy avatar
    1 posts
    Member since:
    Mar 2010

    Posted 31 Aug 2011 Link to this post

    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!



  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 02 Sep 2011 Link to this post

    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 >>

  3. kaddy
    kaddy avatar
    1 posts
    Member since:
    Mar 2010

    Posted 02 Sep 2011 Link to this post

    Thanks, that's just what we needed.
  4. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 03 Sep 2011 Link to this post

    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 >>

  5. Christ
    Christ avatar
    9 posts
    Member since:
    Feb 2011

    Posted 05 Sep 2011 Link to this post

    Hi Stefan,

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

    Thanks,
    Christ
Back to Top