亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ASP.NET MVC分頁問題解決

 更新時(shí)間:2017年01月19日 15:26:36   作者:wangwust  
這篇文章主要為大家詳細(xì)介紹了ASP.NET MVC分頁問題的解決方法,Ajax.Pager分頁的使用注意事項(xiàng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

在使用Ajax.Pager進(jìn)行分頁的時(shí)候需要注意一下幾個(gè)方面:

  1、一定要引入jquery.unobtrusive-ajax.min.js這個(gè)js;

  2、一定要在頁面中使用注冊(cè)分頁器,注冊(cè)方法:@{Html.RegisterMvcPagerScriptResource();};

具體的使用方法示例:

<div class="row" style="position: relative; left: 30%">
  <div class="col-md-8" style="width: auto">
    @{
      PagerConfig pagerConfig = new PagerConfig("pageIndex", "pageIndexBox", "goToBtn");
      PagerOptions options = pagerConfig.GetPagerOption();
    }
    @Ajax.Pager(Model, options).AjaxOptions(a => a.SetUpdateTargetId("articles").SetHttpMethod("Post").SetDataFormId("searchView"))
  </div>
  <div class="col-md-4">
    <div class="input-group" style="width: 120px; margin: 20px 0">
      <input type="text" id="pageIndexBox" class="form-control" />
      <span class="input-group-btn"><button class="btn btn-primary" id="goToBtn">跳轉(zhuǎn)</button></span>
    </div>
  </div>
</div>

其中Model是IpagedList對(duì)象,獲取PagerOptions的方法如下:

/// <summary>
    /// 翻頁配置項(xiàng)
    /// </summary>
    /// <returns></returns>
    public PagerOptions GetPagerOption()
    {
      PagerOptions options = new PagerOptions
      {
        AutoHide = false,
        FirstPageText = "首頁",
        LastPageText = "尾頁",
        NextPageText = "下一頁",
        PrevPageText = "上一頁",
        PageIndexParameterName = this._pageIndexParaName,
        ContainerTagName = "ul",
        CssClass = "pagination",
        CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
        DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
        PagerItemTemplate = "<li>{0}</li>",
        PageIndexBoxId = this._pageIndexBoxId,
        GoToButtonId = this._goToButtonId,
        NumericPagerItemCount = 5
      };

      return options;
    }

目前所知,該控件不支持顯示記錄總數(shù)及總頁數(shù)。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論