.Net Razor + Passing raw HTML to @helper macro

I want to pass raw html to @helper macro ... is this possible? For example:

@helper oneColumn(string content) { <div class="row"> <div class="twelve columns"> @content </div> </div> } @put.oneColumn( <h1 id="page-heading">HELLO WORLD!</h1> ) 
+8
razor
source share
3 answers
 @helper oneColumn(Func<dynamic,HelperResult> content) { <div class="row"> <div class="twelve columns"> @content(null) </div> </div> } @put.oneColumn( @<h1 id="page-heading">HELLO WORLD!</h1>) 
+23
source share

Use the @Html.Raw HTML helper or create the contents of an IHtmlString .

+1
source share
 @helper oneColumn(string content) { var contentHtml = new HtmlString(content); <div class="row"> <div class="twelve columns"> @contentHtml </div> </div> } @put.oneColumn( "<h1 id=\"page-heading\">HELLO WORLD!</h1>" ) 
0
source share

All Articles