在一个下拉列表中紧随城市之后,首先绑定国家 [英] bind country first after city in one dropdown
本文介绍了在一个下拉列表中紧随城市之后,首先绑定国家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个下拉列表中将国家/地区与城市绑定.单击下拉列表时,其外观将如下所示.
前四个是国家/地区,然后是-----,然后是同一城市中的下拉列表
英国
阿联酋
蒂兰
法国
--------
迪拜
巴黎
ETC
bind country after city in one dropdown.it will look like this when click on dropdown.
first 4 are countries then ----- and then cities in same drop down
UK
UAE
THILAND
FRANCE
--------
DUBAI
PARIS
ETC
推荐答案
您可以在查询中执行UNION并将这两个值一起加载.
E,g,
You can do a UNION in your query and load both these values together.
E,g,
Select CountryCode, Country from Country
UNION
select CityCode, City from City
当然,如果城市和国家/地区具有相同的代码,那么这将行不通!
Of course, if city and country have the same code, then this is not going to work!
如果您已经添加了国家/地区,则添加如下内容,
if you already added countriest then add like below,
DropDownList1.Items.Add(new ListItem("-----", "-----"));
DropDownList1.Items.Add(new ListItem("DUBAI", "DUBAI"));
这篇关于在一个下拉列表中紧随城市之后,首先绑定国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文