Question

I have following code

@Html.Pager((IPagination)Model.FoundUsers).Last("<span class=\"last\">&nbsp</span>").First("<span class=\"first\">&nbsp</span>").Next("<span class=\"next\">&nbsp</span>").Previous("<span class=\"prev\">&nbsp</span>")

But it renders encoded and shows <span class="next"> on page.

I tried to used Html.Raw as suggested in Problem with razor view and mvccontrib grid pagination or How to make a pager with MVCContrib and Razor?

but it still does not work for me.

What am I doing wrong ?

Était-ce utile?

La solution

I would assume that you are using MvcContrib v2 with Mvc4 (or possibly Mvc3)?

Either manually download the newer libraries from http://mvccontrib.codeplex.com or use the Raw method. So instead of this:

@Html.Pager((IPagination)Model.FoundUsers).Last("<span class=\"last\">&nbsp</span>").First("<span class=\"first\">&nbsp</span>").Next("<span class=\"next\">&nbsp</span>").Previous("<span class=\"prev\">&nbsp</span>")

You would instead have:

@Html.Raw(Html.Pager((IPagination)Model.FoundUsers).Last("<span class=\"last\">&nbsp</span>").First("<span class=\"first\">&nbsp</span>").Next("<span class=\"next\">&nbsp</span>").Previous("<span class=\"prev\">&nbsp</span>"))

Autres conseils

Perhaps it's because I am working in VB, but I had to get the appropriate string from the Pager object:

@Html.Raw(Html.Pager(Model).ToString)

I'm using MvcContrib 2.0.95 with MVC 3.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top