动态下拉列表 [英] dynamic drop down list

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

问题描述



我正在尝试通过2个下拉列表绑定数据.

我有2张桌子:
1) 国家 :
country_id(主键)
国家名
2) 状态 :
state_id(主键)
state_name
country_id(foreign_key)


现在我试图用2个下拉列表绑定数据
ddp1 ddp2 .
这样,当我从第一个下拉列表(ddp1)中选择国家时,与该国家/地区相对应的州应出现在第二个下拉列表(ddp2)中.

有人可以帮帮我吗.

谢谢.

解决方案

您正在谈论级联下拉列表.只需Google/CP搜索即可.

您正在寻找的是根据第一个下拉列表中选择的值填充第二个下拉列表.
之前是服务器端,然后是传统的AJAX == XMLHttpRequest.现在,我们可以使用更新"面板或PageMethod.

如果没有其他要求, Ajaxtoolkit会有一个级联下拉列表 [使用SQL数据库的AJAX级联下拉示例 [ ^ ]

感谢您的回复.....

我以为这与c#有关,因为我对ajax不太熟悉.而且我必须通过做同样的事情来展示我的项目.


感谢您的回复........... ::-)


Hi

I am trying to bind data with 2 dropdowns.

I am having 2 tables :
1)country:
country_id(primary key)
country_name
2)state:
state_id(primary key)
state_name
country_id(foreign_key)


now i tried to bind the data with 2 dropdown list
ddp1 and ddp2.
such that when i select the country from first dropdown(ddp1) then the state corresponding to that country should come in the second dropdown(ddp2).

Can some one please help me .

Thanks .

解决方案

You are talking of a Cascading Dropdown. Just Google/CP Search for it.

What you are looking for is populating a second dropdown based on the value selected in first dropdown.
Earlier it was Server side, then traditional AJAX==XMLHttpRequest. Now, we can use Update panel or PageMethod for it.

If not anything else, Ajaxtoolkit has a cascading dropdown[^] control.

Look at this article too:
AJAX Cascading Dropdown Example using SQL Database[^]


Thanks for your reply.....

I was thinking this to do with c# as i am not much familiar with ajax. And i have to show my project by doing the same.


thanks for your reply...........:-)


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

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