Reputation: 1
Sorting, Filtering, and Paging in an ASP.NET MVC 5 Application.
My Code:
@model PagedList.IPagedList<PublicRelations.Models.Suggestion>
@using PagedList.Mvc;
...
...
...
<table class="table table-hover table-striped table-responsive">
<tr>
<th>
@Html.ActionLink(model => model.Name, "Index", new { sortOrder = ViewBag.NameSortParm })
</th>
<th>
...
...
...
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
...
...
...
</table>
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))
Error :
@Html.ActionLink(model => model.Name, "Index", new { sortOrder = ViewBag.NameSortParm })
error : Cannot convert lambda expression to type 'string' because it is not a delegate type. ????
Upvotes: 0
Views: 2848
Reputation: 1
I use the code of this page to sorting and filtering etc. Two way links in the text where they are manually entered. I'm determined according to the titles links Model headlines.
Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application
Upvotes: 0
Reputation: 462
Make sure you have imported System.Linq
namespace
If already then please provide some additional information to understand exact problem area.
Hope helps.
Upvotes: 1