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.

Cell background color in databound grid

Thread ID:





5676 Jul 14,2003 12:29 AM Jul 14,2003 02:14 AM Windows Forms 1
Tags: GridControl
Christian Morand
Asked On July 14, 2003 12:29 AM

Hello. Is there an easy way to directly set the background color of a cell in databound grid? For example, when the cell contains some specific value I would like to have its background painted with a specific color. Regards Christian

Administrator [Syncfusion]
Replied On July 14, 2003 02:14 AM

You can use PrepareViewStyleInfo...
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.ColIndex > 0 && e.RowIndex > 0)
			double dValue = double.Parse(e.Style.Text);
			if( dValue > 100 )
        			e.Style.BackColor = Color.Red;
		catch { } //empty


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.