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