The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team 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.