Configuring the Object Data Source

You will now add an ObjectDataSource control //数据源对像控件to your project and configure it to use the data access class //数据访问对像you just created.

1.  Click the Authors.aspx tab //制表符,统计表and ensure that you are in Design view. From the Toolbox, in the Data section, drag an ObjectDataSource//数据源对像 onto the design surface, placing it next to the existing SqlDataSource control.

2.  In the ObjectDataSource Tasks menu click Configure Data Source//配置数据源. In the Configure Data Source wizard, uncheck //不选Show only data components. For Choose your business object select DataAccess and then click Next.

3.  In Define Data Methods, for Choose a method select GetAuthors, and then click Next.

 

The Define Parameters step//定义参数这一步 should look familiar. This is where you tell the data source to use the selected stateDropDownList value as a parameter in the SELECT statement.

4.  For Parameter source select Control. For ControlID select stateDropDownList, and for DefaultValue enter "CA". Then click Finish.

5. Finally, give the ObjectDataSource control a more meaningful ID. In the Properties window //属性窗口change the (ID) property to "authorsObjectDataSource". Press CTRL+S to save your work.

Your object data source is now configured and ready for consumption //使用,消费by the GridView control.

 

posted on 2007-04-10 15:29  改变热爱  阅读(308)  评论(0)    收藏  举报

导航