I've noted that @
statement in Razor templates converts quotes in strings into HTML symbols.
How can I show correct HTML attribute then? Sample code:
<body@(ViewBag.Highlight == true ? " onload=\"prettyPrint()\"" : "")>
result:
<body onload="prettyPrint()">
That's completely incorrect. How can i achieve normal:
<body onload="prettyPrint()">
in my case?
I've tried HtmlString
object from this answer. But it's impossible to convert HtmlString
to string
even with explicit type cast.