public IEnumerable
public IEnumerable
public IEnumerable
partial view partPozicijeView.cshtml
@model PagedList.IPagedList
@using PagedList.Mvc;
@{ some code to show table }
and main view index.cshtml
@model WebApplication3.ViewModels.mainViewModel
@using PagedList.Mvc;
@Html.Partial("partKnjigeNormativaView", Model)
@Html.Partial("partGrupeRadovaView", Model)
@Html.Partial("partPozicijeView", Model)
that calls 3 partial views to show first 2 tables in cascaded dropdowns and 3rd one (pozicije) in a table.
Now i'm trying to add pagination to that table, but no matter what, i'm getting an error
The model item passed into the dictionary is of type 'WebApplication3.ViewModels.mainViewModel', but this dictionary requires a model item of type 'PagedList.IPagedList`1[WebApplication3.ViewModels.mainViewModel]'.
on 3rd partial view call.
Here's also code for controller
public ActionResult SelectPozicije(string SelectedPosId, int? pnum)
{
int pageNumber = (pnum ?? 1);
mainViewModel mv = new mainViewModel();
mv.pozicije = new List
// mv.pozicije = (from p in mainViewModel.getPozicije()
// where p.grupa == SelectedPosId
// select p).ToPagedList(pageNumber, 25);
mv.pozicije = (from p in mainViewModel.getPozicije()
where p.grupa == SelectedPosId
select p).ToList();
return PartialView("partPozicijeView", mv);
}
I tried (commented code) to return .ToPagedList() but no success...
can someone point me how to do this?
Replies
Know the answer? Post it — somebody with the same question will find it here.