Name and ID are stored in database. I want to display all name and ID from database to ViewPage Dropdown. Here I displayed Name column only in drop down. Is there possible to display two columns in single drropdown?? Please let me know the solution. Thank You!
Below code write in controller:
var Employe = (from table in dc.tbl_EmployeeDetails
select table.Employee_Name).ToList();
ViewData["empName"] = Employe ;
var department = (from table in dc.tbl_EmployeeDetails
select table.Department).ToList();
ViewData["dept"] = department;
Clientside code(ViewPage):-
<select id="reportto" disabled="disabled" font-size:14px">
@foreach(var person in ViewData["empName"] as List<string>)
{
if(@Model.employee!=@person)
{
<option>@person</option>
}
}
</select>
Here I have displayed Name only in dropdown. How to display both name and department in single dropdown?