外文翻译-英文文献-使用两个DropDownList过滤的主从报表

上传人:cn****1 文档编号:562121676 上传时间:2022-12-13 格式:DOC 页数:29 大小:1.98MB
返回 下载 相关 举报
外文翻译-英文文献-使用两个DropDownList过滤的主从报表_第1页
第1页 / 共29页
外文翻译-英文文献-使用两个DropDownList过滤的主从报表_第2页
第2页 / 共29页
外文翻译-英文文献-使用两个DropDownList过滤的主从报表_第3页
第3页 / 共29页
外文翻译-英文文献-使用两个DropDownList过滤的主从报表_第4页
第4页 / 共29页
外文翻译-英文文献-使用两个DropDownList过滤的主从报表_第5页
第5页 / 共29页
点击查看更多>>
资源描述

《外文翻译-英文文献-使用两个DropDownList过滤的主从报表》由会员分享,可在线阅读,更多相关《外文翻译-英文文献-使用两个DropDownList过滤的主从报表(29页珍藏版)》请在金锄头文库上搜索。

1、 Master/Detail Filtering With Two DropDownListsIntroductionIn the previous tutorial we examined how to display a simple master/details report using a single DropDownList populated with the categories and a GridView showing those products that belong to the selected category. This report pattern work

2、s well when displaying records that have a one-to-many relationship and can easily be extended to work for scenarios that include multiple one-to-many relationships. For example, an order entry system would have tables that correspond to customers, orders, and order line items. A given customer may

3、have multiple orders with each order consisting of multiple items. Such data can be presented to the user with two DropDownLists and a GridView. The first DropDownList would have a list item for each customer in the database with the second ones contents being the orders placed by the selected custo

4、mer. A GridView would list the line items from the selected order.While the Northwind database include the canonical customer/order/order details information in its Customers, Orders, and Order Details tables, these tables arent captured in our architecture. Nonetheless, we can still illustrate usin

5、g two dependent DropDownLists. The first DropDownList will list the categories and the second the products belonging to the selected category. A DetailsView will then list the details of the selected product.Step 1: Creating and Populating the Categories DropDownListOur first goal is to add the Drop

6、DownList that lists the categories. These steps were examined in detail in the preceding tutorial, but are summarized here for completeness. Open the MasterDetailsDetails.aspx page in the Filtering folder, add a DropDownList to the page, set its ID property to Categories, and then click the Configur

7、e Data Source link in its smart tag. From the Data Source Configuration Wizard choose to add a new data source.Figure 1: Add a New Data Source for the DropDownList (Click to view full-size image)The new data source should, naturally, be an ObjectDataSource. Name this new ObjectDataSource CategoriesD

8、ataSource and have it invoke the CategoriesBLL objects GetCategories() method.Figure 2: Choose to Use the CategoriesBLL Class (Click to view full-size image)Figure 3: Configure the ObjectDataSource to Use the GetCategories() Method (Click to view full-size image)After configuring the ObjectDataSourc

9、e we still need to specify which data source field should be displayed in the Categories DropDownList and which one should be configured as the value for the list item. Set the CategoryName field as the display and CategoryID as the value for each list item.Figure 4: Have the DropDownList Display th

10、e CategoryName Field and Use CategoryID as the Value (Click to view full-size image)At this point we have a DropDownList control (Categories) thats populated with the records from the Categories table. When the user chooses a new category from the DropDownList well want a postback to occur in order

11、to refresh the product DropDownList that were going to create in Step 2. Therefore, check the Enable AutoPostBack option from the categories DropDownLists smart tag.Figure 5: Enable AutoPostBack for the Categories DropDownList (Click to view full-size image)Step 2: Displaying the Selected Categorys

12、Products in a Second DropDownListWith the Categories DropDownList completed, our next step is to display a DropDownList of products belonging to the selected category. To accomplish this, add another DropDownList to the page named ProductsByCategory. As with the Categories DropDownList, create a new

13、 ObjectDataSource for the ProductsByCategory DropDownList named ProductsByCategoryDataSource.Figure 6: Add a New Data Source for the ProductsByCategory DropDownList (Click to view full-size image)Figure 7: Create a New ObjectDataSource Named ProductsByCategoryDataSource (Click to view full-size imag

14、e)Since the ProductsByCategory DropDownList needs to display just those products belonging to the selected category, have the ObjectDataSource invoke the GetProductsByCategoryID(categoryID) method from the ProductsBLL object.Figure 8: Choose to Use the ProductsBLL Class (Click to view full-size imag

15、e)Figure 9: Configure the ObjectDataSource to Use the GetProductsByCategoryID(categoryID) Method (Click to view full-size image)In the final step of the wizard we need to specify the value of the categoryID parameter. Assign this parameter to the selected item from the Categories DropDownList.Figure

16、 10: Pull the categoryID Parameter Value from the Categories DropDownList (Click to view full-size image)With the ObjectDataSource configured, all that remains is to specify what data source fields are used for the display and value of the DropDownLists items. Display the ProductName field and use the ProductID field as the value.Figure 11: Specify the Data Source Fields Used for the DropDownLists

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号