O'Reilly logo

Microsoft® Office SharePoint® Designer 2007 Bible by Vikram Kartik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16.3. Using ASP.NET Controls with SharePoint Data Sources

Because SharePoint (WSS v3 and MOSS) is based on ASP.NET 2.0, you can also use the generic ASP.NET 2.0 data display controls with SharePoint data sources. When you open a SharePoint Web site in SharePoint Designer, the Data Source Library task pane shows all the available lists, libraries, and other data sources associated with the Web site. If you right-click on a data source in the Data Source Library task pane, an option to insert a data source control for the data source appears. You can bind this data source control with a generic ASP.NET data control to display data on a Web page.

In the following exercise, I show you how you can use the ASP.NET GridView control to display data from a SharePoint list. Follow these steps:

  1. Using the SharePoint interface, create a new Announcements list on your Web site and then add several items to this list.

  2. Open the SharePoint site in SharePoint Designer and then enable the Data Source Library task pane.

  3. Use the New dialog box to create a new ASPX page and then place the cursor in the Design view.

  4. In the Data Source Library, expand SharePoint Lists, right-click on the newly created Announcements list, and then choose Insert Data Source Control from the popup menu. An SPDataSource control is inserted on the Web page.

  5. Using the Toolbar task pane, insert a GridView control on the Web page.

  6. Using the Common GridView Tasks menu, select the SPDataSource control from the Choose Data Source dropdown ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required