Conventional Introduction: Asp.net MVC 3 loads cshtml files to create custom pages

Source: Internet
Author: User

Idea: Expand htmlhelper to load the mvc3 template page or the ascx user control in MVC2 to customize the paging layout and style.

Implementation: The pagemodel page type includes:

Pageindex page index

Pagetext page display text

Pager paging controls

The pagertemp paging control loads the cshtml or ascx name.

Pagerid: the ID of the paging control.

Pagination of pagershow

Pagesize: number of records displayed per page

Curpage index of the current page

The minimum number of pagenum pages displayed[Offset]

Total totalpage pages

Total totalsize Record Data

List <pagemodel> page number list

Controllername controller name

Actionname action name

Pagehelper pagination control generation class, extended htmlhelper used to create pagination Control

Public static mvchtmlstring Pager (this htmlhelper helper,
String pagerid, // Paging Control ID
Int curpage, // Current page number
Int totalsize, // Total number of records
String pagertemp = "_ pagertemp ", // Pagination control Template
Int pagesize = 10, // 10 entries per page
Int pagenum = 5 // Number of displayed page numbers
){

// Create a paging Control

}

_ Pagetemp: page control display template

Similar blog garden effects:

CodeClick to download

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.