ASP. net mvc paging solution, asp. netmvc

Source: Internet
Author: User

ASP. net mvc paging solution, asp. netmvc

When using Ajax. Pager for paging, pay attention to the following aspects:

1, be sure to introduce jquery. unobtrusive-ajax.min.js this js;

2. Be sure to use the register page splitter on the page. Registration Method: @ {Html. RegisterMvcPagerScriptResource ();};

Example:

<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 =>. setUpdateTargetId ("articles "). setHttpMethod ("Post "). setDataFormId ("searchView") </div> <div class = "col-md-4"> <div class = "input-group" style = "width: 120px; margin: 20 p x 0 "> <input type =" text "id =" pageIndexBox "class =" form-control "/> <span class =" input-group-btn "> <button class = "btn-primary" id = "goToBtn"> redirect </button> </span> </div>

Model is an IpagedList object. The method for obtaining PagerOptions is as follows:

/// <Summary> /// flip configuration item /// </summary> /// <returns> </returns> public PagerOptions GetPagerOption () {PagerOptions options = new PagerOptions {AutoHide = false, FirstPageText = "Homepage", LastPageText = "last page", NextPageText = "next page", PrevPageText = "Previous Page", 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 ;}

Currently, this control does not support displaying the total number of records and the total number of pages.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.