PageAdmin CMS网站管理系统官方论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

新做的网站,产品页怎么改排序 [复制链接]

1#
http://www.boy-smart.com/product/
高手帮我看看怎么产品怎么调整一下顺序,现在的产品排版顺序不是我想要的
分享 转发
TOP
2#

下面是产品列表页面模板文件内容。
  1. @{
  2.     int columnId = Html.CurrentColumnId();//当前栏目id
  3.     PageInfo pageInfo = new PageInfo()
  4.     {
  5.         PageSize = 12,//每页显示12条数据
  6.         CurrentPage = (int)ViewBag.CurrentPage //当前页码,系统预设
  7.     };
  8.     var dataList = Html.InfoDataList(new { ColumnId = columnId}, null, null, pageInfo);
  9. }
  10. <div class="container padding-top-20">
  11.     <div class="row">
  12.         <div class="col-md-3">
  13.             @Html.Partial("leftNavPartial")
  14.         </div>
  15.         <div class="col-md-9">
  16.             @Html.Partial("BreadcrumbPartial")
  17.             <div class="prodlist clearfix" id="productList">
  18.                 <!--产品列表-->
  19.                 <ul class="padding-top-10 image-same-size">

  20.                     @{
  21.              foreach (var item in dataList)
  22.              {
  23.                  string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
  24.                  string thumbnail = item.Thumbnail;
  25.                  string title = item.Title;
  26.                  string date = item.Thedate.ToString("yyyy-MM-dd");

  27.                 <li>
  28.                     <div class="prodbox">
  29.                         <a href="@url">
  30.                             <div class="padding-top-16 text-center"><strong>@title</strong> </div>
  31.                             <div class="prodimg"><img src="@thumbnail" alt="" /></div>
  32.                         </a>
  33.                     </div>
  34.                 </li>
  35.                  }
  36.                     }
  37.                 </ul>
  38.                 <!--产品列表 end-->
  39.             </div>
  40.             @Html.Partial("PagebreakPartial", pageInfo)
  41.         </div>
  42.     </div>
  43. </div>
复制代码
TOP
3#

自己顶一下
TOP
4#

var dataList = Html.InfoDataList(new { ColumnId = columnId}, null, null, pageInfo);
里面加一个OrderBy排序方式,可以自定义排序字段
var dataList = Html.InfoDataList(new { ColumnId = columnId,OrderBy="thedate desc"}, null, null, pageInfo);
TOP
5#

谢谢,现在通过改时间可以排序了
TOP
发新话题 回复该主题