2016-10-02 361 views
1

使用ajax选项时,如何在PagedListPager中使用PagedListRenderOptions如何在使用ajax选项时在PagedListPager中使用PagedListRenderOptions?

@Html.PagedListPager((IPagedList)Model, page => 
Url.Action("AllProducts", "Products", new { page }), 
PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "productsContent", OnBegin = "onBeginLoader", OnComplete = "onComplete" })) 

我wnat财产以后这样的修改:

@Html.PagedListPager((IPagedList)ViewBag.posts, page => 
Url.Action("Index", new { page = page }), new PagedListRenderOptions 
{ LinkToFirstPageFormat = "<< ابتدا", LinkToPreviousPageFormat = "< قبلی", LinkToNextPageFormat = "بعدی>", LinkToLastPageFormat = "آخرین >>" }) 
+0

请编辑你的问题,包括视图代码和控制器代码 – Monah

回答

0

您可以使用以下

@Html.PagedListPager((IPagedList)ViewBag.posts, 
          page => Url.Action("Index", page }), 
         PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
              LinkToFirstPageFormat = "", 
              LinkToLastPageFormat = "آخرین >>", 
         new AjaxOptions(){ HttpMethod = "GET", 
              UpdateTargetId = "YourTarget",})) 

这里一个sample关于如何使用Ajax PagedList

希望这将帮你

+0

谢谢http://stackoverflow.com/users/2718699/hadi-hassan但这并不为我工作? –

+0

请检查样品,它包含您如何操作的详细信息,提供控制器的代码和视图以查看它 – Monah

+0

我检查了样品,但它对我没有意义! –

0

我已经完成了。 要自做的fllow:

 
Html.PagedListPager((IPagedList)Model, page => Url.Action("AllProducts", "Products",new { page }), 
PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
new PagedListRenderOptions { LinkToFirstPageFormat = " ابتدا", LinkToPreviousPageFormat = " قبلی", LinkToNextPageFormat = "بعدی", LinkToLastPageFormat = "آخرین " }, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "productsContent", OnBegin = "onBeginLoader", OnComplete = "onComplete" })) 

相关问题