asp.net mvc - Can I write an inline if with HTML content? -


i want write like:

@( checkcondition ? "<span class='label'>right!</span>" : "") 

but showing source code instead html, there easy way this?

thank you!

you can use @html.raw(mystring) method this:

@( checkcondition ? html.raw("<span class='label'>right!</span>") : html.raw("")) 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -