You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
The razor parser checks HTML tags to assure they are balanced. This seems like a nice thing to do except it does this check only within the current code block (between the same set of braces, for example). We ran into this when looping through a list of strings and doing layout by making the even-index strings on the left and odd-index strings on the right, two to a row. Each row is enclosed in a div. We tried to insert the outer div open tag before even indexes and the div close tag after the odd indexes, but this fails even though it seems like a reasonable thing to do. Something like below will fail because the "if" statement contains an open div tag, but no close. The div close tag is in a different if statement. Sure, there are work-arounds. (loop and outer code block omitted):
bool even = (0 == (i % 2));
var name = myNames[i];
if (even)
{
<div id="outerDiv"> <div class="leftColumn">@name</div> } // some other markup added here if (!even) { <div class="rightColumn">@name</div> </div> }