WEBGRID SORTING NOT WORKING

Manish Sahu

Total Post:47

Points:331
Posted by  Manish Sahu
 450  View(s)
Ratings:
Rate this:

webgrid sorting not working

I'm using webgrid to show data from my data base. i want to show date wise record.

here is my code

@{

    var grid = new WebGrid(Model, canSort: true, canPage: true, rowsPerPage: 50, sortFieldName: "Active", default:"PostedDate" ajaxUpdateContainerId: "updategrid");
}
  1. Sunil Singh

    Post:45

    Points:323
    Re: webgrid sorting not working

    You can try this

    @{
        var grid = new WebGrid(Model.OrderByDescending(x=>x.PostedDate), canSort: true, canPage: true, rowsPerPage: 50, sortFieldName: "Active",  ajaxUpdateContainerId: "updategrid");
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!