Sample:
@{
var s = "<p>Sample text</p>";
}
Expectation:
Sample text.
I want it rendered on browser but I couldn't render it. It just outputs the whole value of s as text string. I already try
@(new HtmlString(s))
encoded it with HttpUtility.HtmlEncode
and decode it with HttpUtility.HtmlDecode
but still no use.
You will need
<div >@((MarkupString)s)</div>
@code
{
string s = "<p>Sample text</p>";
}
The <p>
will render inside the <div>