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
close icon

How to change the color of a cell?

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

4 Replies

AD Administrator Syncfusion Team 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. http://64.78.18.34/Support/article.aspx?id=560 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.


DB David Bosak 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.


AR Arindam 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


AD Administrator Syncfusion Team 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.

423530.zip

Loader.
Live Chat Icon For mobile
Up arrow icon