Consuming the Object Data Source
In this lesson you will change the GridView control's data source from a SqlDataSource
control to an ObjectDataSource control. You will see how the current functionality
supported by your custom data class affects the GridView's functionality.
1. Notice that the GridView control currently has an Edit
column visible. Open the GridView Tasks menu and notice
Enable Editing is checked.
2. For Choose Data Source select authorsObjectDataSource.
When prompted to refresh Fields and Keys, click Yes.
Notice that the Enable Editing option and the Edit column are now missing. This
is because your data layer class currently only exposes a method for retrieving
data, not updating data. The design-time tools are able to analyze the object data
source and tailor the functionality offered to you
when creating a user interface.
3. Press ESC to close the GridView Tasks
menu and then press F5 to run the application.
4. When the page loads select UT and verify that the GridView
still works as expected.
5. Close the browser.
You have successfully changed your GridView control's data source to a data access tier object.
Powered By ASP.NET v2.0