带有EnableUnobtrusiveAjaxReplacing和其他渲染选项的PagedList.MVC

时间:2014-07-16 17:45:14

标签: model-view-controller pagedlist

我有这样的传呼机:

@Html.PagedListPager(Model.komentarzeListModeracja, page => 
    Url.Action("ModeracjaKomentarze", new { 
        DotyczyID = Model.DotyczyID, page 
        }), 
    PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { 
        HttpMethod = "Get", UpdateTargetId = "ModeracjaUpdate1" 
        }))

你能告诉我如何为此添加其他渲染选项?可能吗 ?。

2 个答案:

答案 0 :(得分:1)

已经有几个版本\ flavor包含在类中(启用了intellisense:Classic到OnlyShowFivePagesAtATime,Minimal和Bootstrap等)。

PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.TwitterBootstrapPagerAligned, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "divpagedlist" }))

PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.ClassicPlusFirstAndLast, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "divpagedlist" }))

简单地说,该类的逗号分隔属性。

此时为PagedListRenderOptions(Class)属性提供了一个很好的参考: http://www.nudoq.org/#!/Packages/PagedList.Mvc/PagedList.Mvc/PagedListRenderOptions (请注意这个网站是测试版,不能确定链接有效期多长)

答案 1 :(得分:0)

另一种方式......

@Html.PagedListPager(Model, page => Url.Action("FileIndex",
new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }),
PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new PagedListRenderOptions()
{
    DisplayLinkToLastPage = PagedListDisplayMode.IfNeeded,
    DisplayLinkToFirstPage = PagedListDisplayMode.IfNeeded,
    Display = PagedListDisplayMode.IfNeeded,
    LiElementClasses = new List<string> { "myClass", "yourClass" },
    MaximumPageNumbersToDisplay = 10
}, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "fileListTable" }))