Hello everyone...
in paging in web page in asp.net mvc it result a error:
The model item passed into the dictionary is of type 'PagedList.PagedList`1[SelemHomes.Models.tbl_market_news]', but this dictionary requires a model item of type 'PagedList.IPagedList`1[SelemHomes.Models.News]'.
How i can fix that and paging in the web page is run
my code in HomeController.cs:
public ActionResult News(int? page)
{
tbl_katigories tbl_katigori = db.tbl_katigories.Find(6);
ViewBag.Desc = tbl_katigori.Desc;
ViewBag.Keywords = tbl_katigori.Keywords;
return View(db.tbl_market_news.OrderBy(s => s.Date).ToList().ToPagedList(page ?? 1, 3));
}
and the code in News.cshtml:
@using PagedList;
@using PagedList.Mvc;
@model IPagedList<selemhomes.models.news>
.....
.....
.....
<table>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelitem => item.ID)
</td>
</tr>
}
</table>
How I can fix that, anyone help me about that, i thank so much