forum

Home / DeveloperSection / Forums / Sorting by date in Webgrid MVC

Sorting by date in Webgrid MVC

Anonymous User 1554 23-Apr-2018

I want to show record by date wise what is the code to do sorting by date

@{

    var grid = new WebGrid(canSort: true, canPage: true, rowsPerPage: 10);
    grid.Bind(Model, autoSortAndPage: false, rowCount: Convert.ToInt32(ViewBag.TotalPost));
    grid.Pager(WebGridPagerModes.All);

}
    <div>
        @grid.Table(tableStyle: "table table-striped",
                                      columns: grid.Columns(
                                     grid.Column("Title", format: @<text>@item.Title</text>),
                                       grid.Column("Date", format: @<text>@item.Date</text>),
                                    )) 
</div>



Updated on 24-Apr-2018
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By