Displaying the results in a DataGrid

After creating a DataSet to hold the search results (see Searching with only one search parameter (ASP.NET) or Searching with multiple search parameters (ASP.NET)), you can use a DataGrid to display the information on the page.

To display the search results in a DataGrid:

  1. On the search page, place the insertion point where you want the DataGrid to appear.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select DataGrid.

    The DataGrid dialog box appears.

  3. In the ID text box, enter a name for the DataGrid such as dgLocation.
  4. In the DataSet pop-up menu, select the DataSet you defined to hold the search results.
  5. Complete the rest of the dialog box as desired.

    For more information, click the Help button on the dialog box.

Here's an example of a DataGrid dialog box that will create a DataGrid with three columns and ten rows, and links to previous and next pages of results.



The DataGrid will appear the first time the search page loads even if the user hasn't conducted a search yet. You can hide the DataGrid when the page loads the first time. See Hiding the DataGrid the first time the page loads.