General, DataGrid Properties Dialog Box

The General tab of the DataGrid Properties dialog box allows you to:

  • Specify a data source that defines what data the grid displays.

  • Specify general formatting options.

  • Specify the option to allow sorting.

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 General tab.

Tasks

UI Elements

  • Show header
    Select this check box to render a row with column headers. You can specify header text on the Columns, DataGrid Properties Dialog Box tab.

  • Show footer
    Select this check box to render a row at the bottom of the columns with footer text. You can specify footer text on the Columns tab.

Behavior

  • Allow sorting
    Causes the grid to support sorting by doing the following:

    • Displaying column headers as LinkButton controls. (The Show header check box must be selected.)

    • Raising the SortCommand event when users click a column header.

    The grid does not actually perform the sort; you do that in an event handler. For details, see Server Event Handling in ASP.NET Web Pages.

See Also

Concepts

Comparing the GridView and DataGrid Web Server Controls