Section 9.2. Data Source Controls

9.2. Data Source Controls

A data source control, which is derived from the System.Web.UI.DataSourceControl class, provides a single object that you can define declaratively (in your web page) or programmatically (in your code-behind). The data source control will own the connection information, the query information, the parameters and the behavior (such as paging and caching), so that you can then bind to various UI objects for display on your web page.

Many data source controls exist, including controls for accessing SQL from SQL Server, from ODBC or OLE DB servers, from XML files, and from business objects. All of these data source controls expose the same properties and methods , and all bind to UI objects (such as DataList and GridView ) in the same way.

Thus, you have various UI controls all binding in the same way to underlying data sources, and the details (the plumbing) are handled by the data source controls for you, simplifying complex data manipulation tasks in web applications.

ASP.NET 1.x developers will find significant changes (and simplifications ) in how your ASP.NET application interacts with underlying data. The ADO.NET object model has been encapsulated in controls, and the details (data sources, tables, relations, and so on) have been pushed down into the framework layer. This frees you from worrying about the details and provides a more uniform API for interacting with various types of data sources.


The data source controls included with the ASP.NET include:

  • ObjectDataSource

  • SqlDataSource

  • AccessDataSource , which is derived from SqlDataSource

  • XMLDataSource

  • SiteMapDataSource

You will see the SQLDataSource (and controls derived from it) used frequently in this book. The SiteMapDataSource is used in the navigation section of Chapter 12, and the ObjectDataSource is used in Chapter 10. The other data source control are not illustrated in this book explicitly, but work in much the same way as those that are demonstrated.



Programming ASP. NET
Programming ASP.NET 3.5
ISBN: 0596529562
EAN: 2147483647
Year: 2003
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net