本文介绍了如何使MVCContrib和剃刀寻呼机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个寻呼机如下:
@using MvcContrib.UI.Pager
@model MvcContrib.Pagination.IPagination&所述; P />
@ Html.Pager(型号)。首先(第一)。最后(上)。下一步(下一步)。previous(previous)
&所述; P />
而不是显示这一点:
It displays this:
<div class='pagination'><span class='paginationLeft'>Showing 1 - 10 of 10841 </span><span class='paginationRight'>First | Previous | <a href="/Home/Events?page=2">Next</a> | <a href="/Home/Events?page=1085">Last</a></span></div>
I also downloaded a sample project from codeproject, but when I run it, I get the same problem.
What could possibly be the problem? Can you guys help me out?
解决方案
Razor automatically encodes html if you return a String. It won't encode Html if you return an IHtmlString.
Does the pager method return a String instead of IHtmlString?
Try using Html.Raw. This method will convert a String to an IHtmlString.
@Html.Raw(Html.Pager(Model).First("First").Last("Last").Next("Next").Previous("Previous"))
这篇关于如何使MVCContrib和剃刀寻呼机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!