带MVCcontrib的MVC3无法渲染/生成html

时间:2012-04-19 21:27:11

标签: c# asp.net-mvc-3 mvccontrib

@model SocialReader.BackOffice.Models.NewsAndCategories
@using MvcContrib.UI.Grid;
@using MvcContrib.UI.Pager;
@using MvcContrib.Pagination;
@using System.Linq;
@using SocialReader.BackOffice.Common;
@{
    ViewBag.Title = "News";
}

<h2>@ViewBag.Message</h2>
<p>
    @Html.ActionLink("Create News", "Create", "News")
</p>

@{Html.RenderPartial("Pager", Model.PagedViewModel.PagedList);}
@Html.Grid(Model.PagedViewModel.PagedList).Columns(column =>
{
    column.For(x => Html.ActionQueryLink(x.Title, "View", new { id = x.Id })).Named("Title").InsertAt(0);
    column.For(x => x.Category.Name).Named("Category").InsertAt(1);
    column.For(x => x.DateUpdated).Named("Date Updated").InsertAt(2);
    column.For(x => x.Published).Named("Is Published").InsertAt(3);
    column.For(x => x.ViewCount).Named("View Count").InsertAt(4);
    column.For(x => x.UserCreated).Named("Authoer").InsertAt(5);
}).Sort(Model.PagedViewModel.GridSortOptions).Attributes(@class => "grid-style")

我有这个代码,我试图对新闻进行分页,但你点击下一个上一个等的分页是我看不到的,页面上的纯HTML而不是呈现的HTML。

<div class='pagination'><span class='paginationLeft'>Showing 1 - 10 of 41 </span><span class='paginationRight'>First | Previous | <a href="/News/Index?page=2">Next</a> | <a href="/News/Index?page=5">Last</a></span></div>

这是我在页面上看到的而不是它呈现的内容。我已经检查了CSS和JS,它们都包括在内。

我做错了什么?任何想法?

由于

1 个答案:

答案 0 :(得分:1)

使用@Html.RenderPartial而不是@{Html.RenderPartial}