I have an issue when ordering an IQueryable. I want to navigate through a property when sorting my list. This is because the property i am trying to orrder by is located within another object. The order property is MyIdentifier and this identifier is located in MyObject in Mymodel
public Models.MyModel GetList(Models.MyModel search, int pageNumber, int pageSize, string sortOrder, string sortColumn)
{
var list = Get(search, currentUser, repository1));
Models.MyModel result = new Models.MyModel();
result.TotalRows = q.Count();
result.GridData = q.OrderBy(sortColumn, sortOrder).Skip(pageNumber).Take(pageSize).ToList();
return result;
}
The issue here is i am passing MyIdentifier in the sortColumn as a string. By what i need to do here is navigate through MyObject end then pass MyIdentifier as sortColumn. like so: MyObject.MyIdentifier. But this does not work. What is the best solution for this?
thanks.