Focus on the rebirth of ASP. NET.4.5.1 MVC5.0: display menu categories and pages by product category

Source: Internet
Author: User

Multi-data paging Effect

 


 

  IEnumerable<Products> Products { ;  PagingInfo PagingInfo { ;   CurrentCategory { ;     }}

 

   PageSize = .repository = ViewResult List( category,  page = = = || p.Category ==                    .OrderBy(p =>- ) *=== category ==  ?=> e.Category ==                           };                    

 

Routing configuration code

   = =                              page = { controller = , action = , category = () { page =  { controller = , action = , page =  { controller = , action =  { page = , 

    MvcHtmlString PageLinks(<, >=  ( i = ; i <= pagingInfo.TotalPages; i++=  TagBuilder(= (i ==

   TotalItems { ;   ItemsPerPage { ;   CurrentPage { ;   {  ()Math.Ceiling(()TotalItems /

 = PartialViewResult Menu( category =            > categories ==>=>

Shared view

Menu. cshtml

@model IEnumerable<>, , ,  { @class =  link = = == =         + (link == ViewBag.SelectedCategory ?  : 

 

 

Product view Section

List. cshtml

@{    ViewBag.Title = }@foreach ( p }<div =>=> Url.Action( { page = x, category =</div>

 

 

 

Shared view

 

ProductSummary. cshtml

<div =>    

 

 

_ Layout. cshtml

<!DOCTYPE html>

 

Statement: This blog attaches great importance to the protection of intellectual property rights, found that the information published by this blog contains a link content infringing its copyright, please contact me, I will be the first time to do the corresponding processing, contact the mailbox ffgign@qq.com.

 

Author: Mark Fan Source: http://cube.cnblogs.com
Note: This statement must be retained without the consent of the author, and the original text connection is clearly provided on the article page. Otherwise, the legal liability will be retained. If you have any questions, you can contact the author via ffgign@qq.com, This article uses the Knowledge Sharing signature-non-commercial use-share the same way 2.5 mainland China License Agreement for license

 

 

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.