This question is locked. New answers and comments are not allowed.
public IQueryable<Collection> Collections
{
get
{
return from c in context.Collections
orderby c.CollectionDate descending
select c;
}
}Index.cshtml
@model IQueryable<MyProject.Models.Collection>
<div>
@{ Html.Telerik().Grid(Model)
.Name("Grid")
.PrefixUrlParameters(false)
.Columns(columns =>
{
columns.Add(c => c.Location.Name).Width(160);
columns.Add(o => o.CollectionDate);
})
.Scrollable()
.Sortable()
.Pageable()
.Filterable()
.Render();
}
</div>Using the above code with the Telerik MVC 2011.3.1115 controls, the grid is not respecting the descending order. Looking at the generated query via the EF Profiler, the query is actually tuning into an "ORDER BY ID ASC". If I do a ToList() on the Collections property, the data in the grid is sorted by CollectionDate, but then *all* of the data is returned back in the query which won't be very efficient.
One other dataoint: I ran this same code when I was using Mindscape's Lightspeed ORM, and it sorted fine.
Any thoughts on where things are going wrong?