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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell background color in databound grid

Thread ID:





5676 Jul 14,2003 04:29 AM UTC Jul 14,2003 06:14 AM UTC WinForms 1
Tags: GridControl
Christian Morand
Asked On July 14, 2003 04:29 AM UTC

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 06:14 AM UTC

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.

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