Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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::
C#
ddlEmployeeNo.DataSourceID = string.Empty;
       ddlEmployeeNo.DataSource=  fetchData.NAVEmployeeList();
       ddlEmployeeNo.DataBind();


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 ???
Posted
Comments
arindamrudra 20-Jan-14 1:13am    
Multiple columns need to be merged to a single entity and then you need to bind.

Hi,

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

as

C#
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.
 
Share this answer
 
Hi,

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

as

C#
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.
 
Share this answer
 
Comments
Codes DeCodes 20-Jan-14 2:13am    
in 3rd line, after new is it field name to be entered or simply enter combination of name, age and position. i could not get it man,,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900