I have html being printed out in a method. Here is the code:
@Html.Raw(Html.GenerateTabs()) //works -- but is inconvinent
Is really did not want to do every method like this. Here is the way i wanted to do it. But it does not work. When when I run the code html prints in the browser.
@Html.GenerateTabs() //prints html in the broswer
<text>@Html.GenerateTabs()</text> //prints html in the broswer
Is there a razor friendly way to do this?
If your code outputs an MvcHtmlString instead of string, it will output properly with the HTML contained therein.
You construct the MvcHtmlString with a static factory method it has, from the string with HTML.
then in view: