Home Sorting, Filtering, and Paging in an ASP.NET MVC Application (Model)
Reply: 2

Sorting, Filtering, and Paging in an ASP.NET MVC Application (Model)

MohammadReza
1#
MohammadReza Published in 2014-02-11 13:58:55Z

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. ????

Dipal Mehta
2#
Dipal Mehta Reply to 2014-02-11 14:11:29Z

Make sure you have imported System.Linq namespace

If already then please provide some additional information to understand exact problem area.

Hope helps.

MohammadReza
3#
MohammadReza Reply to 2014-02-12 19:33:08Z

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

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.837162 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO