2个相关下拉列表 [英] 2 related dropdownlist

查看:87
本文介绍了2个相关下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好...如何将2个不同的dropdownlist与另一个SQLSource相关联.
例如,如果我选择第一个下拉列表值,那么第二个下拉列表中的值也会更改吗?

Hello...how can I related 2 different dropdownlist with a different SQLSource.
For example if I choose the first dropdownlist value, the value in second dropdownlist also change?

推荐答案

hi,

这意味着您必须在数据库中的表

将课程表的日期与第一个下拉列表绑定为



it means you have to tables in the database

bind your date of course table with first drop down as

dropdown1.datasource = your datasource 
dropdown1.datatextfield= "name"
dropdown1.datavaluefield="id"
dropdown1.databind



然后在所选索引上更改了该下拉列表



then on the selected index changed of that dropdown

int i= Connvert.toInt32(ddl.selectedvalue)



根据该ID,您可以从第二个表中获取记录,并将其与dropdown2绑定.



on the basis of that id you can get record from your second table and bind that with your dropdown2


您可能想尝试- ^ ]
You may like to try - AJAX CascadingDropDown[^]


AJAX.NET级联下拉列表
Creating Cascading DropDownLists in ASP.Net
AJAX.NET Cascading Dropdownlist
More

I hope the above information will be helpful. If you have more concerns, please let me know.


这篇关于2个相关下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆