我想在 MVC C# 中对下拉列表进行排序。 这是我的下拉列表。所以我想按“FULLNAME”排序。
@Html.DropDownListFor(c => c.t_PEOPLE,
new SelectList(Model.PEOPLE,
"KEY",
"FULLNAME",
Model.BOTKEY),
new {onchange = "BusinessContact(this.value);" })
我该怎么做?
最佳答案
/* other code here.. */
new SelectList(Model.PEOPLE.OrderBy(x => x.FirstName),
// ^^^^^^^^^^^^^^^^^^^^^^^ this
/* rest of the code here */
关于c# - 如何对@Html.DropDownListFor 进行排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15800308/