Hi,
I'm using EF and I want to add a default order for items in a grid. To do that I've added a call to OrderBy and after that I convert the result to DataSourceResult:
The problem is that if there is no order set (this.HttpContext.Request.Form["sort"] is "") I expect it to use my default ordering, but for some reason ToDataSourceResult completely removes ordering. How can I keep my default order in such cases?
Thanks in advance.
I'm using EF and I want to add a default order for items in a grid. To do that I've added a call to OrderBy and after that I convert the result to DataSourceResult:
var data = context.Subjects.OrderBy(x => x.ScreeningNumber).ToDataSourceResult(request);
The problem is that if there is no order set (this.HttpContext.Request.Form["sort"] is "") I expect it to use my default ordering, but for some reason ToDataSourceResult completely removes ordering. How can I keep my default order in such cases?
Thanks in advance.