连接两个DropDownList [英] Connect the two DropDownList

查看:72
本文介绍了连接两个DropDownList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个省的下拉菜单和一个省中的一个城市选择显示它.
不使用数据库.

紧急需求.

have two DropDown of the provinces and one city in the province choose to show it.
Without using the database.

Urgent need.

推荐答案

除非所有省份的城市总数很小,否则避免使用数据库是一种荒谬的主意.与您看起来所需的数据库查询一样简单的数据库查询应该几乎不需要任何时间.

但是,如果您坚持要这样做,则只需在页面加载时进行两个查询-一个针对所有省份,一个针对所有城市-然后使用LINQ查询内存中的集合.
Unless the total number of cities for all provinces is fairly small, avoiding using the database is a ludicrous idea. A database query as simple as the one you appear to need should take almost no time at all.

However, if you insist on it, just make two queries when the page is loaded - one for all of provinces, and one for all of the cities - and then use LINQ to query the in-memory collections.


这篇关于连接两个DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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