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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Row Color

Thread ID:





19277 Sep 22,2004 01:35 PM UTC Sep 22,2004 05:13 PM UTC WinForms 1
Tags: GridControl
Madhavi Balusu
Asked On September 22, 2004 01:35 PM UTC

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 05:13 PM UTC

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;


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

Live Chat Icon For mobile
Live Chat Icon