Thursday, May 6, 2010

Binding to Data Using a Data Source Control

In previous versions of ASP.NET, data-bound controls such as the DataList and the DataGrid were bound to data using the DataSource property, which required writing code to retrieve, sort, filter, page, and modify data. While this method is still fully supported, data controls in version 2.0 have the added benefit of binding to a data source control using the DataSourceID property instead.
Data source controls greatly expand the capabilities of data-bound controls introduced in version 2.0, such as the GridView, FormView, and DetailsView controls. When used with data source controls, these controls enable users to easily perform database operations from different data sources, with little or no code.

1) add a data source control, such as a SqlDataSource control
2) add a data-bound control, such as a GridView control and bind it to the data source control

The data source control connects to a data source such as a database or middle-tier object and then retrieves or updates data. The data-bound control can then use this data.

No comments:

Post a Comment