Share via


Borders, DataGrid Properties Dialog Box

The Borders tab of the DataGrid Properties dialog box allows you to specify the appearance of the table cells that the grid uses to display information.

Note

ASP.NET version 2.0 comes with a new server control, GridView, with more features than the DataGrid control. For more information, see Comparing the GridView and DataGrid Web Server Controls.

To access this dialog box

  1. In Microsoft Visual Web Developer, open or create an .aspx page.

  2. In Source view, add a DataGrid control to the page in the <form> element. Your code might look like the following:

    <form id="form1" runat="server">
        <div>
        <asp:DataGrid ID="DataGrid1" runat="server"></asp:DataGrid>
        </div>
    </form>
    
  3. Switch to Design view.

  4. Right-click the DataGrid control and click Show Smart Tag.

    The DataGrid Tasks window opens.

  5. Click Property Builder.

    The DataGrid Properties dialog box opens.

  6. Click the Borders tab.

Tasks

UI Elements

Cell margins

  • Cell padding
    The amount of space, in pixels, between the edge of a cell and the cell contents. Setting this property allows you to create a margin around the cell contents.

  • Cell spacing
    The amount of space, in pixels, between cells. Setting this value to a value higher than zero separates the cells. The color of the space between the cells is determined by the DataGrid control's BackColor property, which you can set on the Format tab.

Border lines

  • Grid lines
    The direction in which interior lines (rules) are drawn in the grid (horizontal, vertical, both, or neither). This property has an effect only in browsers that support HTML 4.0 or later.

    Note

    You cannot set the width of gridlines; they are always one pixel wide.

  • Border color
    The color in which the borders and gridlines are displayed. Click the ellipsis button ( VisualStudioEllipsesButton screenshot) to display the Color Picker dialog box.

  • Border width
    The width and units of the border. This value does not affect the width of gridlines.

See Also

Concepts

Comparing the GridView and DataGrid Web Server Controls