Create a DAL for an ObjectDataSource - Part 2

Create A DataAcessLayer for an ObjectDataSource - Part 2
Previous Page
The Data Access Layer can now be wired to a databound control. This following instructions define how to wire the DAL to a gridview.

1.  Build the project to generate the DAL object.
 
2.  Drag and drop an ObjectDataSource onto a web form.  Select "Configure Data Source."
 
3.  Select the business object DAL that was just created.  Note, the DAL must be in the App_Code folder or it will not appear.  
 
4.  Select the GetCustomersLikeR data method in the Select tab. Select "none" on the Update, Insert, and Delete tabs.  
 
5.  The ObjectDataSource is complete.  This is the generated code.  <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetCustomersLikeR" TypeName="CustomerTableAdapters.CustomersTableAdapter">
</
asp:ObjectDataSource>
 
6.  Drag and drop a gridview onto the form. Select the newly created ObjectDataSource as the Data Source.
 
7.  You are done!  Run the app and the gridview will display the data.
 
 Contact Us     Links      ©2010 GeekPhilosopher.com - All rights reserved
Powered by www.ezjooz.com