0

这是我返回帖子列表的 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>

我想为此页面实现一个客户端分页,按日期呈现所有帖子,这可能吗?或者我应该更改我的代码以使其成为服务器端?

4

1 回答 1

0

http://haacked.com/archive/2009/04/13/using-jquery-grid-with-asp.net-mvc.aspx

它很旧但很相关,应该可以帮助您实现您的目标。

于 2013-05-07T18:52:44.027 回答