如何在从数据库中获取的下拉列表文本中显示两个值 [英] How can I display two values into a dropdown list text taken from the database
本文介绍了如何在从数据库中获取的下拉列表文本中显示两个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上我在SQL中有一个包含2列地址和城市的表,我想要发生的是将这两个数据显示在下拉列表文本框中,其值为ID。
解决方案
一种简单的方法是在SQL中将字段连接在一起。然后你只需绑定你的DropDownList并设置DataTextField和DataValueField。
或者,你可以使用第三方控件,它可以在下拉列表中显示多个列。 / BLOCKQUOTE>
Basically I have a table in SQL with 2 columns, Address and City, what I want to happen is to display both data into a dropdown list textbox with the value being the ID.
解决方案A simple way to do this is to concatenate the fields together in SQL. Then you just bind your DropDownList and set the DataTextField and the DataValueField.
Or, you go with a 3rd party control that can show multiple columns in the drop down.
这篇关于如何在从数据库中获取的下拉列表文本中显示两个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文