网格中的下拉列表问题
本文关键字:问题 下拉列表 网格 | 更新日期: 2023-09-27 18:15:12
我有问题,我在mvc telerik grid中有下拉列表一切正常唯一的问题是我在下拉列表中添加了空格但是空格显示在下拉列表的底部我希望它在下拉列表的顶部有空格我的代码是
控制器代码:private void Grid_PopulateAssignedClientCombo()
{
IEnumerable<AssignedClient> ass= assetManagementService.GetAssignedClients();
IList<AssignedClient> l =new List<AssignedClient>();
AssignedClient a = new AssignedClient();
l = ass.ToList();
a.ID = 0;
a.RefAssignedClient_DESC=string.Empty;
l.Add(a);
ViewData["assignedClients"] = l.Select(e => new AssignedClient{ ID = e.ID, RefAssignedClient_DESC= e.RefAssignedClient_DESC});
}
Editor template
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.Telerik().DropDownList()
.Name("AssignedClient")
.BindTo(new SelectList((IList)ViewData["assignedClients"],"RefAssignedClient_DESC", "RefAssignedClient_DESC"))
%>
谁能告诉我该怎么做?
谢谢
变化
l.Add(a);
l.Insert(0, a);
您可以通过ID添加订单。像
l.orderby(p=>p.ID);