This question is locked. New answers and comments are not allowed.
I have a MVC Grid binding using a server and ajax binding and when user sort a column I save the grid's orderby value to database using a webservice call, so when use return back to the page i have to retrieve the orderby value and set it back to grid.
I tried to retrieve the orderby value to viewbag and set it to the sort.orderby as below
The above does not work on the server-side binding and it work partially on ajax binding i.e. it sorts by the column but only in ascending order. The example for GridSortColumn value will be like "Name-asc" or "Name-desc", both this instances it sorts by ascending order only.
I tried to retrieve the orderby value to viewbag and set it to the sort.orderby as below
.Sortable(sort => sort.OrderBy( config => config.Add(ViewBag.GridSortColumn) ))The above does not work on the server-side binding and it work partially on ajax binding i.e. it sorts by the column but only in ascending order. The example for GridSortColumn value will be like "Name-asc" or "Name-desc", both this instances it sorts by ascending order only.