这是我的MVC操作,它返回一个帖子列表:
public ActionResult Posts()
{
var blogPost = _blogRepository.GetAllPost();
var blogPostViewModel = blogPost.ConvertToPostViewModelList();
return View("Posts", blogPostViewModel);
}
这也是我的观点
@model IEnumerable<Blog.Web.UI.ViewModels.PostViewModel>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div>
@foreach (var item in Model)
{
<div>
<h3>
@Html.ActionLink(item.Title, "Post", "Blog", new { postId = item.Id, postSlug = item.UrlSlug }, null)
</h3>
</div>
<div>
<span>Category: </span>@item.Category.Name
</div>
<div>
<span>Tag: </span>@item.Tag.Name
</div>
<div>
@item.CreationDate.ToLongDateString()
</div>
<div>
@Html.DisplayTextFor(p => item.Body)
</div>
}
</div>
我想为这个页面实现一个客户端分页,它按日期呈现所有帖子,是否可能?或者我应该更改我的代码以使其成为服务器端??
答案 0 :(得分:0)
http://haacked.com/archive/2009/04/13/using-jquery-grid-with-asp.net-mvc.aspx
它虽旧但相关,应该可以帮助你实现你想要的目标。