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

上传人:b****1 文档编号:1796993 上传时间:2022-10-24 格式:DOCX 页数:25 大小:963.68KB
下载 相关 举报
外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx_第1页
第1页 / 共25页
外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx_第2页
第2页 / 共25页
外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx_第3页
第3页 / 共25页
外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx_第4页
第4页 / 共25页
外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx_第5页
第5页 / 共25页
点击查看更多>>
下载资源
资源描述

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

《外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx》由会员分享,可在线阅读,更多相关《外文翻译 英文文献 使用两个DropDownList过滤的主从报表.docx(25页珍藏版)》请在冰豆网上搜索。

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

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

Master/DetailFilteringWithTwoDropDownLists

Introduction

Intheprevioustutorialweexaminedhowtodisplayasimplemaster/detailsreportusingasingleDropDownListpopulatedwiththecategoriesandaGridViewshowingthoseproductsthatbelongtotheselectedcategory.Thisreportpatternworkswellwhendisplayingrecordsthathaveaone-to-manyrelationshipandcaneasilybeextendedtoworkforscenariosthatincludemultipleone-to-manyrelationships.Forexample,anorderentrysystemwouldhavetablesthatcorrespondtocustomers,orders,andorderlineitems.Agivencustomermayhavemultipleorderswitheachorderconsistingofmultipleitems.SuchdatacanbepresentedtotheuserwithtwoDropDownListsandaGridView.ThefirstDropDownListwouldhavealistitemforeachcustomerinthedatabasewiththesecondone'scontentsbeingtheordersplacedbytheselectedcustomer.AGridViewwouldlistthelineitemsfromtheselectedorder.

WhiletheNorthwinddatabaseincludethecanonicalcustomer/order/orderdetailsinformationinitsCustomers,Orders,andOrderDetailstables,thesetablesaren'tcapturedinourarchitecture.Nonetheless,wecanstillillustrateusingtwodependentDropDownLists.ThefirstDropDownListwilllistthecategoriesandthesecondtheproductsbelongingtotheselectedcategory.ADetailsViewwillthenlistthedetailsoftheselectedproduct.

Step1:

CreatingandPopulatingtheCategoriesDropDownList

OurfirstgoalistoaddtheDropDownListthatliststhecategories.Thesestepswereexaminedindetailintheprecedingtutorial,butaresummarizedhereforcompleteness.

OpentheMasterDetailsDetails.aspxpageintheFilteringfolder,addaDropDownListtothepage,setitsIDpropertytoCategories,andthenclicktheConfigureDataSourcelinkinitssmarttag.FromtheDataSourceConfigurationWizardchoosetoaddanewdatasource.

Figure1:

AddaNewDataSourcefortheDropDownList(Clicktoviewfull-sizeimage)

Thenewdatasourceshould,naturally,beanObjectDataSource.NamethisnewObjectDataSourceCategoriesDataSourceandhaveitinvoketheCategoriesBLLobject'sGetCategories()method.

Figure2:

ChoosetoUsetheCategoriesBLLClass(Clicktoviewfull-sizeimage)

Figure3:

ConfiguretheObjectDataSourcetoUsetheGetCategories()Method(Clicktoviewfull-sizeimage)

AfterconfiguringtheObjectDataSourcewestillneedtospecifywhichdatasourcefieldshouldbedisplayedintheCategoriesDropDownListandwhichoneshouldbeconfiguredasthevalueforthelistitem.SettheCategoryNamefieldasthedisplayandCategoryIDasthevalueforeachlistitem.

Figure4:

HavetheDropDownListDisplaytheCategoryNameFieldandUseCategoryIDastheValue(Clicktoviewfull-sizeimage)

AtthispointwehaveaDropDownListcontrol(Categories)that'spopulatedwiththerecordsfromtheCategoriestable.WhentheuserchoosesanewcategoryfromtheDropDownListwe'llwantapostbacktooccurinordertorefreshtheproductDropDownListthatwe'regoingtocreateinStep2.Therefore,checktheEnableAutoPostBackoptionfromthecategoriesDropDownList'ssmarttag.

Figure5:

EnableAutoPostBackfortheCategoriesDropDownList(Clicktoviewfull-sizeimage)

Step2:

DisplayingtheSelectedCategory'sProductsinaSecondDropDownList

WiththeCategoriesDropDownListcompleted,ournextstepistodisplayaDropDownListofproductsbelongingtotheselectedcategory.Toaccomplishthis,addanotherDropDownListtothepagenamedProductsByCategory.AswiththeCategoriesDropDownList,createanewObjectDataSourcefortheProductsByCategoryDropDownListnamedProductsByCategoryDataSource.

Figure6:

AddaNewDataSourcefortheProductsByCategoryDropDownList(Clicktoviewfull-sizeimage)

Figure7:

CreateaNewObjectDataSourceNamedProductsByCategoryDataSource(Clicktoviewfull-sizeimage)

SincetheProductsByCategoryDropDownListneedstodisplayjustthoseproductsbelongingtotheselectedcategory,havetheObjectDataSourceinvoketheGetProductsByCategoryID(categoryID)methodfromtheProductsBLLobject.

Figure8:

ChoosetoUsetheProductsBLLClass(Clicktoviewfull-sizeimage)

Figure9:

ConfiguretheObjectDataSourcetoUsetheGetProductsByCategoryID(categoryID)Method(Clicktoviewfull-sizeimage)

InthefinalstepofthewizardweneedtospecifythevalueofthecategoryIDparameter.AssignthisparametertotheselecteditemfromtheCategoriesDropDownList.

Figure10:

PullthecategoryIDParameterValuefromtheCategoriesDropDownList(Clicktoviewfull-sizeimage)

WiththeObjectDataSourceconfigured,allthatremainsistospecifywhatdatasourcefieldsareusedforthedisplayandvalueoftheDropDownList'sitems.DisplaytheProductNamefieldandusetheProductIDfieldasthevalue.

Figure11:

SpecifytheDataSourceFieldsUsedforth

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 天文地理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1