2016-10-02 366 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" })) 

相關問題