asp.net mvc 4 - MVC 4 Razor If splitting div tags -


i have following mvc 4 razor code:

@for (int = 1; <= 100; i++) {      if (currentcol == 1) {         html.raw("<div class=row>");     @*need because can't have open div within if compiler doesnt *@     } if (currentcol == maxcol) {         html.raw("</div>");     }     currentcol++; } 

i trying generate contents of every div class row conditionally start , end tags in different paths of if statements. when use straight html, compiler doesn't , thinks brackets off. seems html.raw solution searches online, when use html.raw, div doesn't show when view source.

does know what's going on?

try prefixing html.raw calls @:

@for (int = 1; <= 100; i++)  {     if (currentcol == 1)      {         @html.raw("<div class=row>");     }      if (currentcol == maxcol)      {         @html.raw("</div>");     }     currentcol++; } 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -