Changing the WebGrid default sort to descending in ASP.NET MVC

Sheonarayan
Posted by Sheonarayan under ASP.NET MVC category on | Points: 40 | Views : 6200
I was facing the problem of changing the default sort order of WebGrid in ASP.NET MVC. Here is the solutions.
   WebGrid grid = new WebGrid(Model, canPage :true, canSort:true, rowsPerPage : 50, defaultSort: "AutoId");
grid.SortDirection = SortDirection.Descending;

Thanks

Comments or Responses

Login to post response