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

How to change the color of a cell?

Thread ID:





21799 Nov 23,2004 10:31 AM UTC Jun 8,2006 03:34 AM UTC WinForms 4
Tags: GridControl
David Bosak
Asked On November 23, 2004 10:31 AM UTC

I did the same thing as guided in Knowledge Base Q10051 "How do I set the text that appears in a cell?". Unfortunately, it doesn''t work. Please help! Below is the guidline from Knowledge Base Q10051 - Info: How do I set the text color that appears in a cell You use the TextColor property of the cell’s style, setting it to Color value. In C#, use gridControl1[rowIndex, colIndex].TextColor = Color.Red; In VB, use gridControl1(rowIndex, colIndex).TextColor = Color.Red

Administrator [Syncfusion]
Replied On November 23, 2004 10:47 AM UTC

Are you using a GridControl or a GridDataBoundGrid? The code you posted should work for a GridControl (as long as it is not being used in a virtual manner), but will not work for a GridDataBoundGrid. See this KB. Now if you are using a non-virtual GridControl, and the code does not work, has the cell been set ReadOnly is some manner? If you are trying to change the color of a readonly cell, first set grid.IgnoreRadOnly = true;, change teh styles, and then set the IgnoreRadOnly back to false. If you can post a sample project showing the code not working, we can probably resolve this issue quickly.

David Bosak
Replied On November 23, 2004 11:16 PM UTC

I am using the GridDataBoundGrid.Your support is adequate. Now it works very well. Thanks a lot Clay Burch.

Replied On June 7, 2006 11:56 PM UTC

What if I am using a GridGroupingControl which is bound to a dataset with 4 different datatables? How do i changed the backcolor of the ce;; if the value in the cell on one of those tables is above or below a certain value? I am running a for loop that iterates through each cell in the each of the 4 datatables and I would like to change the backcolor in the grid cell if certain cell value is above or below x. Thanks

Administrator [Syncfusion]
Replied On June 8, 2006 03:34 AM UTC

Hi Arindam, The gridGroupingControl1.QueryCellStyleInfo event can be handled and there the cell value can be checked and the back color can be applied. Sample attached. Regards, Calvin.



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