i use this code to fill dropdownlist
ViewData["projectType"] = new SelectList
(_dataManager.Project.ProjectTypeList(), "Id", "Name");
but what i must do if i want to use not one table column but two or more columns? for example
ViewData["projectType"] = new SelectList
(_dataManager.Project.ProjectTypeList(), "Id", "Name1"+"Name2");
Just add a property to your model ViewModel:
public partial class Project
{
public string FullName
{
get { return Name1 + Name2; }
}
}
and use this property:
ViewData["projectType"] = new SelectList(
_dataManager.Project.ProjectTypeList(),
"Id",
"FullName"
);