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.

How to change the color of a cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

21799 Nov 23,2004 05:31 AM Jun 7,2006 11:34 PM Windows Forms 4
loading
Tags: GridControl
David Bosak
Asked On November 23, 2004 05:31 AM

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 05:47 AM

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.

David Bosak
Replied On November 23, 2004 06:16 PM

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

Arindam
Replied On June 7, 2006 07:56 PM

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 7, 2006 11:34 PM

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

CONFIRMATION

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.

;