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.

Row Color

Thread ID:

Created:

Updated:

Platform:

Replies:

19277 Sep 22,2004 09:35 AM Sep 22,2004 01:13 PM Windows Forms 1
loading
Tags: GridControl
Madhavi Balusu
Asked On September 22, 2004 09:35 AM

Hi I have a data bound grid and I set row colors depending on the value of one of the cells. The problem is when I click into one of the cells for example a date cell of the grid (CellValueType = typeof(System.DateTime)) with row color red, the background of the date cell is also red. I want the row to remain red, but when I click on any cell and the cell starts displaying/activates the cell control, I want to cell to be white background. How do I do this? Thanks!

Administrator [Syncfusion]
Replied On September 22, 2004 01:13 PM

In PrepareViewStyleInfo (which you might be using to set the row color), you can check for CurrentCell.IsEditing, and set the BackColor accordingly.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.ColIndex == e.ColIndex && cc.RowIndex == e.RowIndex && cc.IsEditing)
		e.Style.BackColor = Color.White;
	else if(cc.ColIndex > 0 && cc.RowIndex == e.RowIndex)
		e.Style.BackColor = Color.Red;
}

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.

;