Friday 29 January 2010

Binding to Data Using a Data Source Control

Data source controls greatly expand the capabilities of data-bound controls such as the GridView, FormView, and DetailsView controls. By working together, data source controls and data-bound controls let you retrieve, modify, page, sort, and filter data from different data sources with little or no code.

Binding by Using the DataSourceID Property

You can work with data in a data-bound control by binding the data-bound control to a data source control such as a LinqDataSource, ObjectDataSource, or SqlDataSource control. The data source control connects to a data source such as a database, entity class, or middle-tier object and then retrieves or updates data. The data-bound control can then use this data. To perform the binding, you set the data-bound control's DataSourceID property to point to a data source control. When a data-bound control is bound to a data source control, little or no additional code is required for data operations. The data-bound control can automatically take advantage of the data services provided by the data source control.

In earlier versions of ASP.NET, data-bound controls were bound to data by using the DataSource property. This required that you write code to handle operations such as displaying, paging, sorting, editing, and deleting data. Although you can bind controls to data by using the DataSource property (and use existing code), you can also performing data binding by using the DataSourceID property instead. In general, using the DataSourceID property provides more automatic functionality than using the DataSource property.

Follow this link to read more
http://msdn.microsoft.com/en-us/library/ms228089.aspx

No comments:

Post a Comment