如何从阵列数据源一起在Dropdownlist中显示多个列 [英] How Do I Display Multiple Columns In Dropdownlist Together From Array Datasource

查看:66
本文介绍了如何从阵列数据源一起在Dropdownlist中显示多个列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个数组来保存从具有多列的数据源中提取的记录列表......现在,我想显示几列(比如3列)。为了做到这一点,我做了以下编码: :

i am using an array that keeps list of records extracted from datasource that has multiple columns... Now, i wanted to display few columns (say 3 columns).. In order to do so, I did the following coding::

ddlEmployeeNo.DataSourceID = string.Empty;
       ddlEmployeeNo.DataSource=  fetchData.NAVEmployeeList();
       ddlEmployeeNo.DataBind();





这里,NAVEmployeeList()返回包含name,id等列的员工列表数组,名称,年龄,职位。我试图只绑定名称,年龄和位置,但上面的代码只给了我ddlEmployeeNo中的名字..我该怎么做才能在dropdownlist中将这三列放在一起???



here, NAVEmployeeList()returns array of employee list that contains column like name, id, designation, age, position. etc. I attempted to bind only name, age and position but the above code gave me only name in ddlEmployeeNo.. What should i do to get these three columns together in dropdownlist ???

推荐答案

您好,



您可以返回一个具有名称,年龄和位置组合的额外属性,并将其绑定到DropDownList的DataTextField属性。



as



Hi,

You can return an extra property having combination of name, age and position and bind this to DropDownList's DataTextField property.

as

ddlEmployeeNo.DataSourceID = string.Empty;
       ddlEmployeeNo.DataSource=  fetchData.NAVEmployeeList();
ddlEmployeeNo.DataTextField =fetchData.<new combination="" of="" age="" and="" position="">
       ddlEmployeeNo.DataBind();</new>





如果同意,请添加为已解决。



please add as solved if agreed.






您可以返回一个具有名称,年龄和位置组合的额外属性,并将其绑定到DropDownList的DataTextField属性。



as



Hi,

You can return an extra property having combination of name, age and position and bind this to DropDownList's DataTextField property.

as

ddlEmployeeNo.DataSourceID = string.Empty;
       ddlEmployeeNo.DataSource=  fetchData.NAVEmployeeList();
ddlEmployeeNo.DataTextField =fetchData.<new combination of name, age and position>
       ddlEmployeeNo.DataBind();





如果同意,请添加为已解决。



please add as solved if agreed.


这篇关于如何从阵列数据源一起在Dropdownlist中显示多个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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