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

Column color

Thread ID:





27912 Apr 20,2005 09:44 AM UTC Apr 20,2005 09:56 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On April 20, 2005 09:44 AM UTC

Hi, I want to set the specific colors to the whole columns. Like among the 50 columns i want to set color depending upon the header value. Which method is used for this and where to call this method Regards Pratiksha

Administrator [Syncfusion]
Replied On April 20, 2005 09:56 AM UTC

What kind of grid are you using? In a GridControl, you can set the BackColor of a column by setting grid.ColStyles[colIndex].BackColor. So, after the grid has been populated with its header text (maybe in Form.Load), you could loop through the columns from 1 to grid.ColIndex, testing the header text for the column and setting the grid.ColStyles[colIndex].BackColor accordingly. In a GridDataBoundGrid, the BackColor of a column is set using the GridBoundColumn.StyleInfo.backColor for that column. So, again after the grid has been populated you could loop through the collection of GridBoundColumn objects, testing GridBoundColumn.Headertext and setting GridBoundColumn.StyleInfo.BackColor accordingly. If you have explicitly added GridBoundColumns to your grid, then you would loop through this collection, grid.GridBoundColumns. If you have not added GridBoundColumns, then you would loop through this collection, grid.Binder.InternalColumns.


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

or the page will be automatically redirected to 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