16.2. Displaying Data with ASP.NET Data Controls

The third and final step toward showing data on an ASP.NET Web page by using data controls is about binding the data source control to a data display control. Data display controls are responsible for showing the data that's exposed by the data source controls. At browse time, these controls are rendered on Web pages to provide the interface for displaying data.

Most of the ASP.NET 2.0 controls can be bound to data source controls. However, ASP.NET 2.0 offers special controls for displaying data from data sources in a tabular or grid format. This section discusses how you can bind the data source controls you configured earlier to display and format data on Web pages.

16.2.1. Binding with data source controls

As mentioned earlier, most of the ASP.NET 2.0 controls can be bound to data source controls to display data on the Web pages. For example, you can use the following steps in SharePoint Designer to bind an ASP.NET DropDownList control to the SQLDataSource data control:

  1. Insert an SQLDataSource control on your ASPX page and then configure it to use a SELECT statement to return a number of records from a table in your database.

  2. Using the Toolbox task pane, insert a DropDownList control on your Web page. The Common DropDownList Tasks menu appears in the Design view.

  3. Click Choose Data Source to open the Data Source Configuration Wizard, as shown in Figure 16.13. Here, you specify the column that you want to display in the dropdown ...

Get Microsoft® Office SharePoint® Designer 2007 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.