This documentation is archived and is not being maintained.

Specifying Grid Item Format in a DataGrid Web Server Control

Visual Studio .NET 2003

You can format items in the DataGrid Web server control to customize their appearance. You can:

The formatting you set is applied in the order listed above. The grid as a whole is formatted first. If you specify an item format, that is applied next, and if you've specified a column style, that is applied last. For example, suppose you specify a format for the Item and AlternatingItem types. If you also specify a format for a column (for example, a button column) the button column format takes precedence, and the column is displayed with no difference between item and alternating item rows.

To set the format for the grid as a whole

  1. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the Properties window.
  2. In the DataGrid Properties dialog box, click the Format tab, and then choose DataGrid from the Objects list.
  3. Choose font, color, and alignment options.

You can override the grid-wide settings for each type of item.

To set the format for an individual item

  1. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the Properties window.
  2. In the DataGrid Properties dialog box, click the Format tab, and under Objects do one of the following:
    • Select Header, Footer, or Pager.

      -or-

    • Expand the Items node and select the type of item to format.
  3. Choose font, color, and alignment options for that item, and then choose Apply.

To set the format for an individual column

  1. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the Properties window.
  2. In the DataGrid Properties dialog box, click the Format tab, and under Objects expand the Columns node and select the column to format.
  3. Expand the column and select whether you are formatting the column's header, footer, or content. If you do not specify formatting for a portion of the column (for example, you do not format the column's header), that portion is displayed with the defaults inherited from the grid or item.
    Note   To remove column formatting, clear the formatting values.

See Also

Adding DataGrid Web Server Controls to a Web Forms Page | DataGrid Web Server Control | Introduction to the DataGrid Web Server Control

Show: