Export (0) Print
Expand All

Adding Bound Columns to a DataGrid Web Server Control

Visual Studio .NET 2003

Using bound columns in a DataGrid Web server control allows you to specify which columns from the data source to display, customize the header and footer for each column, and control sorting.

To add bound columns to a DataGrid control

  1. Add a DataGrid to the page. For more information, see Adding DataGrid Web Server Controls to a Web Forms Page.
  2. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the Properties window.
  3. In the DataGrid Properties dialog box, click the Columns tab.
  4. Clear the Create columns automatically at run time check box.
  5. In the Available columns box, expand Data Fields and select a field to display, then click the Add button (Aa984251.vxadd(en-us,VS.71).gif).
  6. Optionally, set the header text and footer text for each column you add. If you want to use an image rather than text for the header, select an image in the Header image box.
    Note   The header and footer will be displayed only if you have selected Show header and Show footer in the General tab.
  7. If you want to be able to sort by the contents of the column, set the Sort expression for the column. For details, see Adding Sorting to a DataGrid Web Server Control.
  8. If you want the data in the column to be formatted — for example, if you want to specify how a date is displayed — set the Data formatting expression. For information about creating a formatting expression, see Composite Formatting.

See Also

DataGrid Columns | Adding Button Columns to a DataGrid Web Server Control | Adding Hyperlink Columns to a DataGrid Web Server Control | Adding Template Columns to a DataGrid Web Server Control | DataGrid Web Server Control

Show:
© 2014 Microsoft