I have lots of complex HTML reports in my current project where there we perform lots of conditional rendering of TRs and TDs with rowspans and colspans.
It could so
I had a similar problem - my solution Html.Raw("");
if (isTrue) { } ... if(isTrue) { @Html.Raw(""); // <-- closing tag! }