如何让两个ddl实现联动?

在页面的搜索条件里有两个dropdownlist控件,如何实现选中前面一个ddl时,后面的ddl里面的内容实现联动?
[58 byte] By [longshaoye] at [2008-1-9]
# 1
如果不是动态的就用js写,如果是动态(连接数据库)的就用xmlhttp或者ajax,例子不少,你应该可以搜索到
# 2
如果是动态,且不想使用xmlhttp或者ajax,可以将AutoPostBack属性设置为True,然后通过在下拉事件中写代码实现。
bobomouse-波波 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 3
只要把第一个的值当第二个的参数
yqwaxyq at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 4
不是动态的!要实现这种效果!选中第一个ddl的第一项时,后面的ddl里面的选项更新为第一项的子内容;选中第一个ddl的第二项时,后面的ddl里面的选项更新为第二项的子内容.....
longshaoye at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 5
你如果能确定,第2个里面是第一个对应的那可以用js来实现!
function select1()
{
var select1 = document.getElementById("第一个dll的id").selectindex;
var select2 = document.getElementById("第2个dll的id");
select2[select1].selected;
}

function select2()
{
var select1 = document.getElementById("第一个ddl的id");
var select2 = document.getElementById("第二个ddl的id").selectIndex;
select1[select2].selected;
}
marxTen-marxTen at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 6
你在ddl1,ddl2里面加onchange()就可以了!
marxTen-marxTen at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 7
不过首先你得ddl要帮定数据!不然就显示不了了!
marxTen-marxTen at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 8
还是不太明白!选中第一个ddl的第一项时,后面的ddl里面的选项更新为第一项的子内容(里面有多项);选中第一个ddl的第二项时,后面的ddl里面的选项更新为第二项的子内容(里面也有多项).....
longshaoye at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 9
在第一个ddl的 SelectedIndexChanged 事件中绑定第二个ddl数据。
# 10
网上一大把
最好是用ajax,用.net的CallBack也可以做
# 11
在第一个ddl的 SelectedIndexChanged 事件中绑定第二个ddl数据.................
页面要求不刷新的哦!
longshaoye at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 12
http://www.cnblogs.com/singlepine/archive/2005/10/19/257954.html
haonanernet-与时俱进 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...