@if (Model.commentList != null && Model.commentList.Count != 0) { string url = string.Empty; int pageCount = Model.CommentRecordCount % Model.PageSize > 0 ? (Model.CommentRecordCount / Model.PageSize) + 1 : Model.CommentRecordCount / Model.PageSize; int currentPageTmp = 0; //上一页 if (Model.PageCurrentIndex != 1) { currentPageTmp = Model.PageCurrentIndex - 1; url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + currentPageTmp + ".html#review"; <a href="@url"><<</a> } //首页 if (Model.PageCurrentIndex == 1) { <text><em>1</em></text> } else { url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + 1 + ".html#review"; <a href="@url">1</a> } //当前页左部 currentPageTmp = Model.PageCurrentIndex - 2; if (currentPageTmp == 1) { currentPageTmp++; } //左部省略号( 跨度超过3就显示省略号) if (Model.PageCurrentIndex - 1 > 3) { <text>…</text> } //左部页码( 显示当前页之前两页(不包括第一页)) while (currentPageTmp > 1 && currentPageTmp < Model.PageCurrentIndex ) { url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + currentPageTmp + ".html#review"; <a href="@url">@currentPageTmp</a> currentPageTmp++; } //当前页 if (Model.PageCurrentIndex != 1 && Model.PageCurrentIndex != pageCount) { <text><em>@Model.PageCurrentIndex </em></text> } //当前页右部(不包括当前页) int forewordCount = 2; currentPageTmp = Model.PageCurrentIndex + 1; //右部页面(不显示当前页,不包括最后一页) while (currentPageTmp < pageCount && forewordCount > 0) { url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + currentPageTmp + ".html#review"; <a href="@url">@currentPageTmp</a> currentPageTmp++; forewordCount--; } //右部省略号(跨度超过3就显示省略号) if (pageCount - Model.PageCurrentIndex > 3) { <text>…</text> } //尾页 if (Model.PageCurrentIndex == pageCount) { <text><em>@pageCount</em></text> } else { url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + pageCount + ".html#review"; <a href="@url">@pageCount</a> } //下一页 if (Model.PageCurrentIndex != pageCount) { currentPageTmp = Model.PageCurrentIndex + 1; url = "/hotel_review-d" + Model.CityID + "-s" + Model.HotelId + "-pi-" + currentPageTmp + ".html#review"; <a href="@url">>></a> } }