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.
Unfortunately, activation email could not send to your email. Please try again.

GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

48460 Aug 28,2006 05:19 PM Aug 29,2006 01:18 AM Windows Forms 1
loading
Tags: GridControl
Ken
Asked On August 28, 2006 05:19 PM

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

Thanks

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

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;

else{}
}

Let me know if you need any further assistance.
Regards,
Rajagopal

CONFIRMATION

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.

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.

;