Reputation: 878
I'm trying to add a line break between Can get report and Can order in a table cell like this:
Can get report
Can order
This is code in csHTML file:
<tbody>
<tr>
@{
string role = string.Empty;
if (p.CanGetReport)
{
role = "Can get report" + "<br/>";
}
if (p.CanOrder)
{
role = role + "Can order";
}
}
<td>@string.Format(role)</td>
</tr>
</tbody>
Already used string.Format to encode the tag <br/>
to a break line in output. But it doesn't work as I expected.
this is the output:
Can get report <br/>Can order
Need help!
Upvotes: 0
Views: 54
Reputation: 24903
To output html tags from string you shoul use method HtmlHelper.Raw
@Html.Raw(role)
Upvotes: 4