Scott Mitchell's ASP. NET 2.0 data tutorial 8: Using Two dropdownlists

Source: Internet
Author: User


Original English version | code in this tutorial
Introduction

In the previous guide, we studied how to display a simple Master/Slave report. The report uses the DropDownList and GridView controls to populate the DropDownList, And the GridView displays the products of the selected category. this type of report is suitable for displaying records with One-to-multiple relationships. It can also be easily expanded to display data with multiple one-to-multiple relationships. for example, an order system should contain a table indicating the customer, order, and order details. A customer may have multiple orders, and each order contains multiple order items. this data can be presented to the user using two dropdownlists and one GridView. the first DropDownList should contain a list of all customers in the database, and the second DropDownList contains the order of the selected customers. the GridView is used to list the Order details of the selected order.

Step 1: Create a DropDownList and fill it with category data

Our first goal is to add a DropDownList that can list categories. These steps have been analyzed in detail in the previous guide, but it is necessary to briefly summarize them here to maintain the integrity of this Guide.

Open MasterDetailsDetails In the Filtering folder. aspx: Add a DropDownList to the page, set its ID to Categories, and click the Configure Data Source link on the Smart Tag. in the data source Configuration Wizard, select Add a data source.

Figure 1: Add a new data source to DropDownList

Of course, the new data source should be ObjectDataSource. Name the new ObjectDataSource as CategoriesDataSource and ask him to call the GetCategories () method of the CategoriesBLL object.

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.