We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





48460 Aug 28,2006 09:19 PM UTC Aug 29,2006 05:18 AM UTC WinForms 1
Tags: GridControl
Asked On August 28, 2006 09:19 PM UTC

Is there any way I can set column header styleInfo
dynamically, and how about based on the level in GridDataBoundGrid?


Administrator [Syncfusion]
Replied On August 29, 2006 05:18 AM UTC

Hi Ken,

You can handle the PrepareViewStyleInfo event of the grid to do this. Try the below code snippet.

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
GridBoundRecordState state = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(e.RowIndex);
int levelIndex = state.LevelIndex;

if (levelIndex == 0 && e.RowIndex <= this.gridDataBoundGrid1.Model.Rows.HeaderCount && e.ColIndex > 0)
e.Style.BackColor = Color.Plum;

else if (levelIndex == 1 && e.RowIndex <= this.gridDataBoundGrid1.Model.Rows.HeaderCount && e.ColIndex > 0)
e.Style.BackColor = Color.AliceBlue;


Let me know if you need any further assistance.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon