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 : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell color on a databoundgrid cell

Thread ID:

Created:

Updated:

Platform:

Replies:

60812 May 11,2007 07:57 PM UTC May 11,2007 09:03 PM UTC WinForms 1
loading
Tags: GridControl
Marc
Asked On May 11, 2007 07:57 PM UTC

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?

haneefm [Syncfusion]
Replied On 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

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.

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

;