如何使用DataView筛选下拉列表列表值 [英] How to use dataview for filter the dropdownlist list values

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

问题描述

如何在下拉列表中使用dataview行过滤器选择索引更改.


例如,两个dropdownList Box,Country和City.如果我选​​择类似于印度的County(dropdownList),然后选择Dipaly City(dropdownList)仅印度列表

How to use dataview row filter in dropdownlist select index change.


For Example, Two dropdownList Box,Country and then City.if i select county(dropdownList) Like india and then Dipaly City(dropdownList) only list of indian
cites only.

推荐答案

将所有城市加载到DataTable中,然后按所选国家/地区进行过滤,在时间和内存方面都没有效率.而是仅从数据库中选择所选国家/地区中的城市.您可以创建一个存储过程,以CountryID作为输入参数,并返回该国家/地区的城市表.在C#代码中,您可以将存储过程的输出绑定到City Dropdown.
Loading all cities in DataTable and then filtering by the selected country is not efficient in terms of time and memory. Instead select only those cities from your database which are in the selected country. You can create a stored procedure that takes the CountryID as the input parameter and returns a table of the cities in that country. In your C# code, you can bind the stored procedure''s output to your City Dropdown.


这篇关于如何使用DataView筛选下拉列表列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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