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

How to show Grid Lines as solid (not borders)?

Hi I want to show Grid lines in solid and also want to color it. I tried to set these properties in gridDataBoundGrid1_PrepareViewStyleInfo Dim grid As GridDataBoundGrid = sender grid.Model.Properties.DisplayHorzLines = True grid.Model.Properties.DisplayVertLines = True grid.Model.Properties.GridLineColor=color.SteelBlue where i am missing, also i dont find in you samples, knowledge base, forums (!?) Am I Right? Regards Rajaraman California SOftware, INDIA

1 Reply

AD Administrator Syncfusion Team February 1, 2003 05:22 PM UTC

PrepareViewStyleInfo is hit every time a cell is drawn on the screen so that the cell specific style can be modified if desired. The settings you are trying to use, are gridwide setting. They apply to the whole grid and don't have to be set for every cell. So, it would be better do the grid wide settings, once say in the form's constructor or Form_Load. If you want to have blue solid lines in the whole grid, then you can do this by setting the TableStyle.Borders property. To get a thin solid line, you can just set two borders to do this. Me.Grid.TableStyle.Borders.Bottom = New GridBorder(GridBorderStyle.Solid, Color.SteelBlue,GridBorderWeight.Thin) Me.Grid.TableStyle.Borders.Right = New GridBorder(GridBorderStyle.Solid, Color.SteelBlue,GridBorderWeight.Thin) Again, since this applies to the whole table, you can just do this once in Form_Load. If you want to do this in PrepareViewStyleInfo, you would set these properties on teh e.Style.Borders. Here, you could condiitionally color the borders (or conditionally change other display properties of the style) based on teh e.ColIndex and e.RowIndex.

Live Chat Icon For mobile
Up arrow icon