Modify a small bug in ASP. net mvc Ajax paging component ASP. NET mvcpager and repair the style for your own use (3)

Source: Internet
Author: User

The following shows how to change the above control to the following style:

 

 

Modify as follows:

Find the pageroptions. CS file,

Autohide = true; pageindexparametername = "pageindex"; numericpageritemcount = 2; alwaysshowfirstlastpagenumber = false; showprevnext = true; prevpagetext = ""; // langhelper. wordget ("Previous Page"); // "Previous Page"; nextpagetext = ""; // langhelper. wordget ("next page"); // "next page"; shownumericpageritems = true; showfirstlast = false; // firstpagetext = langhelper. wordget ("Homepage"); // "Homepage"; // lastpagetext = langhelper. wordget ("last page"); // "last page"; showmorepageritems = true; morepagetext = "... "; showdisabledpageritems = true; separatorhtml =" "; usejqueryajax = false; showpageindexbox = false; showgobutton = true; pageindexboxtype = pageindexboxtype. textbox; maximumpageindexitems = 1; gobuttontext = langhelper. wordget ("jump"); // "jump"; containertagname = "Div"; invalidpagdexdexerrormessage = langhelper. wordget ("invalid page index"); // "invalid page index"; pageindexoutofrangeerrormessage = langhelper. wordget ("page index out of range"); // "page index out of range"; maxpageindex = 0;

Find the pagerbuilder. CS file and append the following code to the original method generateanchor:

Tag. mergeattribute ("href", URL); // switch (item. type) {Case pageritemtype. prevpage: tag. mergeattribute ("class", "enablepreclass"); break; Case pageritemtype. nextpage: tag. mergeattribute ("class", "enablenextclass"); break; Case pageritemtype. numericpage: tag. mergeattribute ("class", "enablenumclass"); break; Case pageritemtype. morepage: tag. mergeattribute ("class", "enablenumclass"); break;} tag. mergeattributes (_ ajaxoptions. tounobtrusivehtmlattributes (); // the original code position ends.

 

Modify the file as follows:

private MvcHtmlString GenerateJqAjaxPagerElement(PagerItem item)        {            if (item.Disabled)            {                string str = "";                switch (item.Type)                {                    case PagerItemType.PrevPage: str = String.Format("<a class=\"disabledPreClass\" disabled=\"disabled\">{0}</a>", item.Text); break;                    case PagerItemType.NextPage: str = String.Format("<a class=\"disabledNextClass\" disabled=\"disabled\">{0}</a>", item.Text); break;                    case PagerItemType.NumericPage: str = String.Format("<a class=\"disabledNumClass\" disabled=\"disabled\">{0}</a>", item.Text); break;                    case PagerItemType.MorePage: str = String.Format("<a class=\"disabledNumClass\" disabled=\"disabled\">{0}</a>", item.Text); break;                }                return CreateWrappedPagerElement(item, str);            }            else            {                return CreateWrappedPagerElement(item, GenerateAnchor(item));            }        }

Foreground CSS style:

.enableNumOrClass{margin-top:20px;}.enableNumOrClass a{display:inline-block;padding:0 8px;height:18px;line-height:18px;text-decoration:none;color:#000000;}.disabledPreClass{background:url(../images/next_Icon0.png) no-repeat center 1px;}.enablePreClass{background:url(../images/next_Icon0.png) no-repeat center -19px;}.enableNextClass{background:url(../images/next_Icon0.png) no-repeat center -59px;}.disabledNextClass{background:url(../images/next_Icon0.png) no-repeat center -40px;}.enableNumClass{border:1px solid #cecece;background:#f9f9f9;}

The downward arrow:

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.