ASP. NET 2.0 data Tutorial: access a typed dataset through The BLL class

Source: Internet
Author: User

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:

 
 
  1. ProductsTableAdapter productsAdapter = new ProductsTableAdapter();  
  2. GridView1.DataSource = productsAdapter.GetProducts();  
  3. 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:

 
 
  1. ProductsBLL productLogic = new ProductsBLL();  
  2. GridView1.DataSource = productLogic.GetProducts();  
  3. 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

  1. How to deploy the asp.net mvc program in IIS6.0
  2. Use Winform to build the asp.net mvc Framework
  3. Programming idea of ASP. NET Session failure
  4. ASP. NET Session state storage
  5. Understand ASP. NET Web Application Models

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.