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

RadGrid ignoring 'GroupHeaderItemStyle-ForeColor' Attribute

2 Answers 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeremi
Top achievements
Rank 1
Jeremi asked on 08 Aug 2014, 07:59 AM
Hi,

I have a RadGrid on one of my ASP pages and I want to change the text color on the group header to something more readable. The default value is quite unreadable, as in the attached example1. I have set the 'GroupHeaderItemStyle-ForeColor="White"'-attribute, but it seems that it is simply ignored at run time. If I set the 'GroupHeaderItemStyle-Font-Bold="true"'-attribute, it is successfully picked up. I have tried setting the 'GroupHeaderItemStyle-CssClass'-attribute to a relevant value as well, but had no success with this as well.

How would I go about achieving this?

The second question I have is how to remove the header columns in the grid for the nested groups as in example 2? I wish to achieve a similar look to the grid in the Telerik example at: http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/grouping/grouping/defaultcs.aspx

Thanks for the assistance!
Regards.


2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 08 Aug 2014, 09:12 AM
Hi Jeremi,

I was able to get fore-color to set from ASPX code itself. Can you try setting from code behind as follows:

C#:
void rgrdSample_PreRender(object sender, EventArgs e)
{  
 foreach (GridGroupHeaderItem headerItem in rgrdSample.MasterTableView.GetItems(GridItemType.GroupHeader))
 {         
   headerItem.DataCell.ForeColor = Color.White;
  }
}

The header columns that appear while grouping is GridGroupSplitterColumn, you can try either setting its visibility to false, or set another skin for your Grid.

C#:
void rgrdSample_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
  if (e.Column is GridGroupSplitterColumn)
  {
    e.Column.Visible = false;
  }
}

If this doesn't help, provide your full code snippet.

Thanks,
Princy
0
Jeremi
Top achievements
Rank 1
answered on 14 Aug 2014, 03:37 PM
Hi Princy,

Thank you for the feedback. I've been off that project for the last couple of days and will be for a couple more. I'll test and provide feedback as soon as I can. Apologies for the delay.

Regards.
Tags
Grid
Asked by
Jeremi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Jeremi
Top achievements
Rank 1
Share this question
or