Но есть одна проблема с передачей параметров с помощью Html.Action.
Параметры поиска:
Код: Выделить всё
public class Document
{
public string Name { get; set; }
public string Title { get; set; }
public string Param1{ get; set; }
public string Param2{ get; set; }
}
Код: Выделить всё
public ActionResult Index(int? page, Document filter)
{
ViewBag.Params= documentFilter;
IEnumerable DocumentList = dbContext.Documents.ToList();
DocumentList = DocumentList.CustomFilter(documentFilter);
var pageNumber = page ?? 1;
var onePageOfProducts = DocumentList.ToPagedList(pageNumber, 50);
ViewBag.Documents = onePageOfProducts;
return View();
}
Помощник по разбиению на страницы:< /p>
Код: Выделить всё
@Html.PagedListPager((IPagedList)ViewBag.Documents,
page => Url.Action("Index", new { page , filter = (Document)ViewBag.filter}))
//Also tried Model instead of ViewBag.filter
Есть ли способ сделать это?
Подробнее здесь: https://stackoverflow.com/questions/325 ... ple-params