Skip to content Skip to sidebar Skip to footer

Inline Helpers And Page Output - How?

I have an HtmlHelper function that returns a MvcHtmlString and which I'd like to call in an inline helper like this: @helper JsCss() { Html.Script('jquery/jquery-1.6.2', cdn: t

Solution 1:

A helper is a code block, you need to prefix the Html.Script with @ so Razor knows you want to output the return value (you don't need the <text></text>):

@helper JsCss()
{
    @Html.Script("jquery/jquery-1.6.2", cdn: true)
}

Post a Comment for "Inline Helpers And Page Output - How?"