ObjectDataSource Control Overview
The ASP.NETcontrol represents a middle-tier object with data retrieval and update capabilities. The ObjectDataSource control acts as a data interface for data-bound controls such as the , , or controls, and enables those controls to display and edit data from a middle-tier business object on an ASP.NET Web page.
Most ASP.NET data source controls, such as the, are used in a two-tier application architecture where the presentation layer (the ASP.NET Web page) communicates directly with the data tier (the database, an XML file, and so on). However, a common application design practice is to separate the presentation layer from business logic and encapsulate the business logic in business objects. These business objects form a layer between the presentation layer and the data tier, resulting in a three-tier application architecture. The ObjectDataSource control supports a three-tier architecture by providing a way for you to bind data controls on the page to a middle-tier business object. The ObjectDataSource works with a middle-tier business object to select, insert, update, delete, page, sort, cache, and filter data declaratively without extensive code.
The ObjectDataSource control uses reflection to call methods of a business object to select, update, insert, and delete data. You set the ObjectDataSource control'sproperty to specify the name of the class to use as a source object. For details on how to create a source data object to be used with the ObjectDataSource control, see .
The ObjectDataSource control can support additional sorting and paging capabilities by passing sort and page information in requests from a data-bound control, such as a GridView control, to the data object for processing. The source data object or the data source control itself can then sort data and return data in pages.
For information on passing sorting and paging parameters to an ObjectDataSource control's data object, see.
If the object returned to the ObjectDataSource control by the source data object is aor object, the ObjectDataSource control supports filtering using the syntax of the property of the class. Filtering enables you to expose only rows that match particular search criteria, without having to re-query the data source with new selection criteria. For more information, see .
By setting the ObjectDataSource control'sproperty to true, you can specify that the ObjectDataSource control should include original values when calling update methods of the source data object. The original values can then be included in checks for optimistic concurrency. For more information, see . For information on optimistic concurrency checking, see .