Html.RenderPartial未正确呈现视图

时间:2013-01-17 08:12:21

标签: asp.net-mvc asp.net-mvc-3 mvccontrib mvccontrib-grid

我在ASP.NET C#MVC 3应用程序中创建了 MvcContrib.UI.Grid 。我为此创建了寻呼机

grid.Please看我的寻呼机代码

  

@using MvcContrib.UI.Pager

     

@using MvcContrib.Pagination

     

@model IPagination

     

@ Html.Pager(型号)。首先( “第一”)。最后( “最后”)。接着( “下一个”)。前( “前”)

在我的视图中调用Pager.cshtml。请看下面的图片

enter image description here

但最后它的渲染就像。

enter image description here

我很无能为力。请帮帮我。

1 个答案:

答案 0 :(得分:1)

如果您正在写一个带有string符号的普通@自动html为您编码。

由于Html.Pager只返回包含html的普通string,因此您需要使用Html.Raw来阻止Razor中的自动编码:

因此,您需要将寻呼机局部视图更改为:

@Html.Raw(Html.Pager(Model)
              .First("First")
              .Last("Last")
              .Next("Next")
              .Previous("Previous").ToString())
相关问题