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.