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

Cell color on a databoundgrid cell

I read the kb article titled "How do I change the Backcolor of a single cell in a GridDataBoundGrid" but I need to change cell color after the grid is already populated. Is there a way to do this?

1 Reply

HA haneefm Syncfusion Team May 11, 2007 09:03 PM UTC

Hi Marc,

By default, DataBoundGrid doesn't store any style info properties. You can not set any cell or row specific properties for the DataBoundGrid other than the CellValue. You need to handle the PrepareViewStyleInfo (or Model.QueryCellInfo) Event to do this. Through this event you can set the style properties for the grid.

To set the BackColor for a cell, you check for the e.RowIndex/e.ColIndex, if that points to the row you desired, set the e.Style.BackColor for it.

If you want to set the cell style property in a grid then call the Refresh or RefreshRange method to fire the QueryCellInfo event to set the style settings of the cell in a grid.

See the KnowledgeBase Articles for more info.
QueryCellInfo event : http://www.syncfusion.com/Support/article.aspx?id=10351
PrepareViewStyleInfo event :http://www.syncfusion.com/Support/article.aspx?id=560

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon