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

Setting Style for range of Columns

hi, How would i set some property lke (back color, width, type ..) for a range of columns? Thanks

3 Replies

AD Administrator Syncfusion Team June 2, 2004 02:04 PM

In a GridControl, you can use grid.ChangeCells passing in a GridRangeInfo object and a style. In a GridDataBoundGrid, you will have to loop through either grid.GridBoundColumns collection or the grid.Binder.InternalColumns collection, changing the GridBoundColumn.StyleInfo object for each column you want to change.


VI Vivek June 2, 2004 03:22 PM

Thanks i tried few things and working fine. I am having problem to do the following. Q1 How would I change column width for a range of columns? I really don’t see any property in GridStyleInfo object. Q2 I am trying to put a “solid” black line at the top of some cell and using following code GridStyleInfo style = new GridStyleInfo(); style.Borders.Top.Style = GridBorderStyle.Solid; style.Borders.Top.Color = Color.Black; style.Borders.Top.Weight = GridBorderWeight.Thick; programGrid.ChangeCells(GridRangeInfo.Cells(1, 1, 1, 5), style); But I am getting the following error messages: ''Syncfusion.Windows.Forms.Grid.GridBorder.Weight'' cannot be assigned to -- it is read only How should I do that? Please do reply! Thanks


AD Administrator Syncfusion Team June 2, 2004 03:35 PM

1) this.gridControl1.ColWidths.SetRange 2) Instead of style.Borders.Top.Style = GridBorderStyle.Solid; style.Borders.Top.Color = Color.Black; style.Borders.Top.Weight = GridBorderWeight.Thick; try style.Borders.Top = new GridBorder(GridBorderStyle.Solid, Color.Black, GridBorderWeight.Thick);

Loader.
Live Chat Icon For mobile
Up arrow icon