ComponentOne GridView for ASP.NET AJAX: GridView for ASP.NET AJAX Task-Based Help > Customizing the Grid's Appearance > Adding Borders and Gridlines to the Grid

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

CellPadding

Integer

CellSpacing

Integer

GridLines

System.Web.UI.WebControls.GridLines

Border Color

The following code changes the color of the grid border to blue:

      Visual Basic

C1GridView1.BorderColor = System.Drawing.Color.Blue

      C#

C1GridView1.BorderColor = System.Drawing.Color.Blue;

Border Style

The following code gives the grid a dashed border:

      Visual Basic

C1GridView1.BorderStyle = BorderStyle.Dashed

      C#

C1GridView1.BorderStyle = BorderStyle.Dashed;

Border Width

The following code makes the grid border width five pixels:

      Visual Basic

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:

      Visual Basic

C1GridView1.CellPadding = 5

      C#

C1GridView1.CellPadding = 5;

Cell Spacing

This code makes the cell spacing of the grid ten pixels:

      Visual Basic

C1GridView1.CellSpacing = 10

      C#

C1GridView1.CellSpacing = 10;

Grid Lines

This code gives the grid horizontal lines but not vertical lines:

      Visual Basic

C1GridView1.GridLines = GridLines.Horizontal

      C#

C1GridView1.GridLines = GridLines.Horizontal;


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.