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.
Syncfusion Feedback

Color another cell in PrepareViewStyleInfo event

Thread ID:

Created:

Updated:

Platform:

Replies:

57102 Feb 26,2007 03:37 PM UTC Feb 27,2007 11:09 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Ronnie Kleinfeld
Asked On February 26, 2007 03:37 PM UTC

Hi,
In a GridDataBoundGrid grid in a the PrepareViewStyleInfo event I can color the current cell:

e.Style.BackColor = Color.Red;

But I need to color another cell right there also. I know its row and column indexes.

I tried:
grid[iRow,iColumn].BackColor = Color.Red;
But it's not working.

Is it possible? How can you do it?

Thanks ahead,
Ronnie.

Administrator [Syncfusion]
Replied On February 27, 2007 11:09 PM UTC

Hi Ronnie,

Try setting the RefreshCurrentCellBehavior property to RefreshRow and handle the PrepareViewStyleInfo event of the grid to set the backcolor of the current cell and it's right adjacent cell. Please try the attached sample and let me know if this helps.

this.grid.Model.Options.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow;

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if( e.RowIndex > 0 && e.ColIndex > 0)
{
GridCurrentCell cc = (sender as GridDataBoundGrid).CurrentCell;
if( cc.RowIndex == e.RowIndex && (cc.ColIndex == e.ColIndex || cc.ColIndex + 1 == e.ColIndex ))
e.Style.BackColor = Color.Red;
}
}

Sample : GDBGBackColor.zip

Best regards,
Haneef

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.

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

;