如何在表格的下拉列表中显示两列或更多列 [英] how to display two or more columns in dropdownlist from a table

查看:685
本文介绍了如何在表格的下拉列表中显示两列或更多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在DDL中显示2列,即'block_code'和'block_name'。

我使用下面的代码显示但引发异常声明:

列'block_codeblock_name'不属于表块。



adds1.Add(ds1.Tables [0] .Rows [i] [block_code+block_name ] .ToString()。ToLower());



任何人都可以指导我,以便我在DropdownList(DDL)中显示两列。 div class =h2_lin>解决方案

你可以cncat你的字段..



ex:select in_product_id +'|'+ vc_product_name为产品的product_detail



并在下拉菜单中使用此结果集..



谢谢。 。


Rajendran



尝试



adds1.Add( ds1.Tables [0] .Rows [i] [block_code]。ToString()。ToLower()+ ds1.Tables [0] .Rows [i] [block_name]。ToString()。ToLower()) ;





如果从db表中选择这两个作为单独的字段,那么它们也将是数据集中的单独字段。


I want to display 2 columns namely 'block_code' and 'block_name' in DDL.
I use the follwoing code to display but throws an exception stating:
"Column 'block_codeblock_name' does not belong to table block."

adds1.Add(ds1.Tables[0].Rows[i]["block_code" + "block_name"].ToString().ToLower());

Can anyone guide me so that I would like to display both the columns in my DropdownList(DDL).

解决方案

You can cncat your fields..

for ex: "select in_product_id + '|' + vc_product_name as "product_detail" from product

and use this result set in dropdown..

Thanks..


Rajendran

Try

adds1.Add(ds1.Tables[0].Rows[i]["block_code"].ToString().ToLower() + ds1.Tables[0].Rows[i]["block_name"].ToString().ToLower());


If these 2 are selected from a db table as separate fields then they would be separate fields in dataset also.


这篇关于如何在表格的下拉列表中显示两列或更多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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