开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜