对列进行排序时,有什么方法可以保留当前页面@grid.GetHtml
?
现在我有这个
public virtual ActionResult Users(int? page)
{
var model = _context.Users();
return View(model);
}
和HTML
@{
var grid = new WebGrid(source: Model,defaultSort: "LastActivity",rowsPerPage: 20);
// Force a descending sort only when no user specified sort is present
if (Request.QueryString[grid.SortDirectionFieldName].IsEmpty())
{
grid.SortDirection = SortDirection.Descending;
}
}
@if (Model != null)
{
@grid.GetHtml(tableStyle:
....
谢谢!