asp.net - IList or IQueryable OrderBy method which accepts a string parameter as selector? -
this asp.net entity framework tutorial describes how can use objectdatasource bll , provide method includes sort expression use gridview.
public ienumerable<department> getdepartments(string sortexpression) { if (string.isnullorwhitespace(sortexpression)) { sortexpression = "name"; } return context.departments.include("person").orderby("it." + sortexpression).tolist(); }
the problem is, uses string sortexpression objectdatasource in orderby() method. can't find reference method anywhere. exist , if not, best way allow sorting of gridview custom bll.
dynamic linq supports orderby string argument: http://dynamiclinq.codeplex.com/
Comments
Post a Comment