Reputation: 1
Can anyone please answer to me as why this is not working?
For simplistic purposes propose I have the following:
var raw = "<div style='background:" + color.HexValue + "'></div>";
I am calling it like this:
<td>@Html.Raw(raw)</td>
And it produces the following:
<td><div style=""></div></td>
I have tried so many different ways and nothing seems to have worked. Also could you point me in the right direction to how this should be properly done.
Upvotes: 0
Views: 4258
Reputation: 41236
You're overcomplicating this situation I think. You could write the following in your view and get the right thing:
<td><div style="background: @{color.HexValue}"></div></td>
Upvotes: 0