【发布时间】:2015-06-17 09:35:33
【问题描述】:
我正在尝试按字母顺序对名称列表进行排序。我以为我可以在我的 LINQ 语句上做到这一点,但事实并非如此,它给我带来了一个错误。有谁知道为什么会这样以及如何解决这个问题?
这是我的加入:
public IQueryable<Supplier> GetAllSuppliersByClientWithClaims(int ClientID) {
return (from s in db.Suppliers
where s.ClientID == ClientID
join h in db.Headers on new { a = s.ClientID, b = s.SupplierID } equals new { a = h.ClientID, b = h.SupplierID }
orderby s ascending
select s);
}
这是视图的下拉菜单:
@Html.DropDownListFor(m => m.ReportTypeOptions.First().ReportID, new SelectList(Model.ReportTypeOptions, "ReportID", "ReportName"), "Select Report", new { @class = "GRDropDown", @id = "ReportDD", onchange="myFunction()"})
【问题讨论】:
-
要在哪个字段上升序排序??
-
我想按 SupplierName 排序