2011-11-21 111 views
0

我有問題,我有下拉列表中MVC Telerik的網格的每一件事情是確定的唯一的問題是我在下拉列表中添加空間,但空間顯示下拉列表的底部我希望它在下拉列表我的代碼頂部空間DROPDOWNLIST問題

控制器代碼:

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")) 
%> 

任何機構可以告訴我,我怎麼能做到這一點。

感謝

回答

1

變化

l.Add(a); 

l.Insert(0, a); 
1

您可以通過ID添加一個訂單。像

l.orderby(p=>p.ID);