Object Data Source Controls
We looked at the data source controls in the last chapter and saw how they replaced the data access code, but tightly coupled the GUI to the data methods. To overcome this problem, Microsoft introduced object data source controls, so that we can bind directly to business objects, making it possible to use them in a 3-tier architecture.
Let's see how using object data source controls will shape our application:
1. Create a new web project using VS.
2. Add a new form named
datasource-customer.aspx
.3. Add an object data source control, as shown here (drag and drop the object data source control from the Data tab under ToolBox in VS):
4. Now, we need to configure this object data source control. We first need to set the Business object , where we select our customer class:
5. Then, we need to set the SELECT, UPDATE, and INSERT methods. For our sample, we will just set the SELECT method:
6. Then, we select Finish. We then add a GridView control on the same page and...