After updating my MVC 3 MVC 4 solution using Razor 2, I ran into the following problem.
This code in view
@{ string main = "archive"; } <div class="selected-@(main == "archive")"></div>
returns this in MVC 3
<div class="selected-True"></div>
and this is in MVC 4
<div class="selected-class"></div>
which breaks my CSS.
Is this a bug introduced by the new conditional attribute function in Razor 2?
My workaround is this:
<div class="selected-@((main == "archive").ToString())"></div>
which returns this:
<div class="selected-True"></div>
Does anyone have a better suggestion?
css conditional attributes asp.net-mvc-4 razor-2
Frank van Eykelen Nov 19 '12 at 9:38 2012-11-19 09:38
source share