In the first section of this tutorial, we provide an example of using a typed dataset directly. However, after we add the BLL class, the presentation layer can work through BLL. In the example of AllProducts. aspx in Section 1 of this tutorial, ProductsTableAdapter is used to bind the product list to the GridView. The Code is as follows:
- ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
- GridView1.DataSource = productsAdapter.GetProducts();
- GridView1.DataBind();
To use the new BLL class, all we need to do is simply modify the first line of code. Replace ProductsTableAdapter with a ProductBLL object:
- ProductsBLL productLogic = new ProductsBLL();
- GridView1.DataSource = productLogic.GetProducts();
- GridView1.DataBind();
The BLL class can also be clearly accessed by using ObjectDataSource, just like a typed dataset ). We will discuss ObjectDataSource in detail in the next tutorial.
Figure 3: product list displayed in the GridView
- How to deploy the asp.net mvc program in IIS6.0
- Use Winform to build the asp.net mvc Framework
- Programming idea of ASP. NET Session failure
- ASP. NET Session state storage
- Understand ASP. NET Web Application Models