I want to do server side sorting of a related table using MvcContrib Grid
I have
@Html.Grid(Model.Result).Columns(column =>
{
column.For(u => u.Name).Named("Name");
column.For(u => u.Country.Name).Named("Country").SortColumnName("Country");
}).Sort(Model.GridSortOptions)
This displays the table/grid correctly. However I cannot sort by Country.Name I get an error
DbSortClause expressions must have a type that is order comparable
I just ended up doing a work around.
I added a new property to my ViewModel called “CountryName” which maps to Country.Name. This works fine.
So my code is now
And my ViewModel