ivs1999 - 2019/3/5 17:46:38
xiyou - 2019/3/5 18:24:46
ivs1999 - 2019/3/6 11:12:47
[b]回复 [url=http://bbs.pageadmin.net/showtopic-58482.aspx#164414]2楼[color=Olive]xiyou[/color]的帖子[/url][/b]
模板里没看到有这些内容呢?:
@{
PageInfo pageInfo = new PageInfo()
{
PageSize =10,//每页显示10条数据
CurrentPage = (int)ViewBag.CurrentPage //当前页码,系统预设
};
}
<div class="container padding-top-20">
<div class="row">
<div class="col-md-3">
@Html.Partial("leftNavPartial")
</div>
<div class="col-md-9">
@Html.Partial("BreadcrumbPartial")
<div class="news-list">
<ul>
@foreach (var item in Html.InfoDataList(new { ColumnId = Html.CurrentColumnId() }, null, null, pageInfo))
{
string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
string thumbnail = item.Thumbnail;
string date = item.Thedate.ToString("yyyy-MM-dd");
<li class="item">
<span class="title">
<a href="@url" target="_self" title="@item.Title">@item.Title</a>
</span>
<span class="date">@date</span>
</li>
}
</ul>
</div>
@Html.Partial("PagebreakPartial", pageInfo)
</div>
</div>
</div>
xiyou - 2019/3/6 11:30:09
@foreach (var item in Html.InfoDataList(new { ColumnId = Html.CurrentColumnId() }, null, null, pageInfo))
加一个OrderBy
@foreach (var item in Html.InfoDataList(new { ColumnId = Html.CurrentColumnId(),OrderBy="id desc" }, null, null, pageInfo))
ivs1999 - 2019/3/6 12:02:06
[b]回复 [url=http://bbs.pageadmin.net/showtopic-58482.aspx#164427]4楼[color=Olive]xiyou[/color]的帖子[/url][/b]
如果我想用“发布日期”或”点击量“进行排序,请问该怎么写呢?如果按ID排的话不方便,因为ID都是系统默认加的,自己没法改
xiyou - 2019/3/6 12:17:36
发布日期倒序
OrderBy="thedate desc"
点击量倒序
OrderBy="clicks desc"
desc倒序,asc是正序
第一个是字段