Rad grid grouping column header style

1 Answer 479 Views
Grid
Chakradhar
Top achievements
Rank 1
Veteran
Iron
Chakradhar asked on 19 Jun 2021, 06:26 AM

HI, 
I'm using rad grid with grouping, i've grouped two columns.

Now i want to give two different colors to those two grouped (App Type, Status) columns.

I need Black color font for Status and Blue color font for App Type.

How to achieve this, please help.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Doncho
Telerik team
answered on 23 Jun 2021, 11:36 AM

Hi Chakradhar,

You can use the ItemDataBound event to get access to each GroupHeaderItem and set its ForeColor conditionally.

For instance:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    var groupHeaderItem = e.Item as GridGroupHeaderItem;
    if (groupHeaderItem != null)
    {
        if (groupHeaderItem.DataCell.Text.StartsWith("App Type"))
        {
            groupHeaderItem.ForeColor = Color.Blue;
        }
        else if (groupHeaderItem.DataCell.Text.StartsWith("Status"))
        {
            groupHeaderItem.ForeColor = Color.Black;
        }
    }
}

You may also find it useful to check out the Customizing GridGroupHeaderItem article.

I hope this will help you achieve the desired.

Please let me know if any further questions come up.

Kind regards,
Doncho
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Chakradhar
Top achievements
Rank 1
Veteran
Iron
commented on 24 Jun 2021, 01:39 AM

thanks it solved my problem
Tags
Grid
Asked by
Chakradhar
Top achievements
Rank 1
Veteran
Iron
Answers by
Doncho
Telerik team
Share this question
or