Adding Borders and Gridlines to the Grid
This topic demonstrates how to add borders and spacing to C1GridView programmatically, using the following properties:
Property |
Data Type |
BorderColor |
System.Drawing.Color |
BorderStyle |
BorderStyle (enum) |
BorderWidth |
System.Web.UI.WebControls.Unit |
Integer | |
Integer | |
System.Web.UI.WebControls.GridLines |
Border Color
The following code changes the color of the grid border to blue:
C1GridView1.BorderColor = System.Drawing.Color.Blue
• C#
C1GridView1.BorderColor = System.Drawing.Color.Blue;
Border Style
The following code gives the grid a dashed border:
C1GridView1.BorderStyle = BorderStyle.Dashed
• C#
C1GridView1.BorderStyle = BorderStyle.Dashed;
Border Width
The following code makes the grid border width five pixels:
C1GridView1.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(5)
• C#
C1GridView1.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(5);
Cell Padding
This code makes the padding within cells five pixels:
C1GridView1.CellPadding = 5
• C#
C1GridView1.CellPadding = 5;
Cell Spacing
This code makes the cell spacing of the grid ten pixels:
C1GridView1.CellSpacing = 10
• C#
C1GridView1.CellSpacing = 10;
Grid Lines
This code gives the grid horizontal lines but not vertical lines:
C1GridView1.GridLines = GridLines.Horizontal
• C#
C1GridView1.GridLines = GridLines.Horizontal;
|