Consuming the Object Data Source--Binding the Object Data Source to the GridView

In this lesson you will change the GridView control's data source//数据源 from a SqlDataSource control//SQL数据源控件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//"Enable Editing " 选项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.//数据访问列\行对像

posted on 2007-04-10 17:14  改变热爱  阅读(178)  评论(0)    收藏  举报

导航