When I use the build in Html Helpers, I can simply write the following.
@Html.Actionlink(bla)
But when I write my own Html Helpers, I need to block the encoding by wrapping it in a MvcHtmlString
@MvcHtmlString.Create(Html.CustomPager(bla))
Is there anything I can do in the extension method so that I don't have to worry about "not" encoding it?
yes, you can make the helper return a MvcHtmlString - i.e:
public static MvcHtmlString Css(this HtmlHelper html, string path)
{
return MvcHtmlString.Create(/* some code*/);
}
rather than:
public static string Css(this HtmlHelper html, string path)
{
return (/* some code*/);
}
i don't know the razor requirements, so this is a blind stab in the dark answer perhaps..