Bind Html.DropDownList
In my Employee table, fields are like EmployeeID, FirstName, MiddleName, LastNam开发者_如何学Ce ,... like that.
I want to bind my Html.DropDownList like EmployeeID as dataValueField and FirstName+MiddleName+LAstName as dataTextField. How can I bind like this?
Create a partial class and set a property like this
public string Name
{
get
{
return string.Format("{0} {1} {2}", FirstName, MiddleName, LastName);
}
}
Give 'Name' as the dataTextField
精彩评论