Reputation: 26929
In controller I want to form a message for example
" 7 results found - Do something now "
And I want it to show that text in the View but I want the first part to be bold so like "7 results found - Do something now" so when I create my string in controller I wrap that part around <b>
tags but it doesn't work! It is showing the exact string with <b>
in the view. How should I do this?
Upvotes: 0
Views: 117
Reputation: 3890
To display HTML in Razor you can use:
@Html.Raw(Model.Property)
This will handle HTML tags for you.
Of course you can also add here string from ViewBag, Resources or just hard coded.
Upvotes: 1
Reputation: 819
Using Html.Raw allows you to output text containing html elements. @Html.Raw("7 results found - Do something now")
Upvotes: 1