RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
DropDownList和ObjectDataSource的配合使用方法

这篇文章主要介绍“DropDownList和ObjectDataSource的配合使用方法”,在日常操作中,相信很多人在DropDownList和ObjectDataSource的配合使用方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”DropDownList和ObjectDataSource的配合使用方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

创新互联主要为客户提供服务项目涵盖了网页视觉设计、VI标志设计、营销网站、网站程序开发、HTML5响应式成都网站建设成都做手机网站、微商城、网站托管及成都网站维护公司、WEB系统开发、域名注册、国内外服务器租用、视频、平面设计、SEO优化排名。设计、前端、后端三个建站步骤的完善服务体系。一人跟踪测试的建站服务标准。已经为成都白乌鱼行业客户提供了网站营销服务。

Categories DropDownList完成后, 下一步就需要一个显示属于选定类别的产品的DropDownList了. 要完成这个功能, 再增加一个DropDownList控件并命名为ProductsByCategory. 与Categories DropDownList一样, 为ProductsByCategory DropDownList创建一个新的ObjectDataSource并命名为ProductsByCategoryDataSource.

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 为ProductsByCategory DropDownList添加新数据源

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 创建一个新的 ObjectDataSource 并命名为ProductsByCategoryDataSource

由于ProductsByCategory DropDownList 需要显示属于选定类别的产品, 让ObjectDataSource 调用ProductsBLL对象的GetProductsByCategoryID(categoryID)方法.

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 选择使用ProductsBLL类

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 配置ObjectDataSource 使用GetProductsByCategoryID(categoryID)方法

在向导的***一步需要指定categoryID的值. 我们把Categories DropDownList的已选择的数据项项作为该参数值.

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 使用categoryID参数从Categories DropDownList接收值

ObjectDataSource配置完成后, 剩下的就是指定DropDownList要显示的字段和作为值的字段了. 设置为显示ProductName并把ProductID做为值字段

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 指定 DropDownList数据项的文本和值使用的数据源字段

ObjectDataSource 和ProductsByCategory DropDownList配置完成后页面上会有两个DropDownList: ***个列出所有的类别,第二个列出属于选定类别的产品. 当用户在***个DropDownList上选择了一个新的类别后, 将会发生一次回发(postback),第二个DropDownList将会重新绑定以显示属于新选定类别的产品. 图12 和图13显示了在浏览器中看到的MasterDetailsDetails.aspx页面.

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: ***次访问页面时Beverages 类别是选中的.

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 选择一个不同的类别时显示该类别的产品

DropDownList和ObjectDataSource的配合使用方法

DropDownList和ObjectDataSource: 激活productsByCategory DropDownList的 AutoPostBack属性

到此,关于“DropDownList和ObjectDataSource的配合使用方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


网站题目:DropDownList和ObjectDataSource的配合使用方法
网站URL:http://sczitong.cn/article/jdpseo.html