tags:

views:

62

answers:

2

I have Dropdown list of Faculty Name. In my database they are stored as FirstName, LastName, MiddleName,

I want to combine it in dropdownlist

ViewData["FacultyID"] = new SelectList(faculty, "ID", "FirstName");

at place of datatextfield.

A: 

You could change your sql query:

SELECT ..., COALESCE(FirstName + ' ' + MiddleName + ' ' + LastName) as FullName,...
grega g
+1  A: 
ViewData["FacultyID"] = 
   new SelectList(faculty.Select(f=> new 
   {id= f.Id, Name = f.Firstname + f.LastName}), "ID", "Name");
Alexander Taran