With RazorViewEngine, I can do this:
if (somecondition) {
some stuff
}
but I can\'t seem to do this (Razor ge
The fact that you have to do this usually indicates that your view code is not factored correctly. The nature of HTML is to have balanced or self-enclosed tags (at least in HTML 4, HTML 5 seems to be leaning away from it) and Razor depends on that assumption. If your going to conditionally ouptut a
. Just put the whoel pair in your if
statement:
@if(something) {
Other stuff
}
Otherwise you end up with weird code like here.