将多个下拉值填充到单个下拉列表中? [英] Populate multiple drop down value into a single dropdown?

查看:109
本文介绍了将多个下拉值填充到单个下拉列表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个asp下拉列表,一个是包含部门列表,另一个是相应部门的部分列表。我想使用c#code..i在单个下拉列表中填充部门及其部分列表。需要一些示例。

I have two asp drop downs one is contains department list another one is section list for the respective department.i wanted to populate the department and its section list in a single drop downlist using c# code..i need some example.

推荐答案

所以你可以使用UNION ALL运算符来解决这个问题。



so u can use UNION ALL operator to solve this.

Select Depart_Name from Dept
Union All
select Section_name from Section

中选择Section_name

试试这个。


Try this.


将dept_id改为任何表之间的联系是。将此数据源设置为下拉列表



Change dept_id to whatever the link between the tables is. Set this as datasource to your dropdown list

SELECT DISTINCT Depart_Name + ' - ' + Section_name
FROM 
Dept d INNER JOIN Section s ON d.dept_id = s.dept_id


这篇关于将多个下拉值填充到单个下拉列表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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