c# - ASP.NET MVC Razor syntax error -
how can translate code razor syntax:
<% (int = 0; < items.length; i++) %> <%{ if (i % 3 == 0) { %> <tr> <% } %> <td><a href="<%: url[i] %>"><%: title[i] %></a></td> <% if (i % 3 == 2) { %> </tr> <% } %> <%} %>
i'm try, not success:
@for (int = 0; < items.length; i++) { if (i % 3 == 0) { <tr> } <td><a href="@(url[i])">@(title[i])</a></td> if (i % 3 == 2) { </tr> } }
i have find solution:
@for (int = 0; < items.length; i++) { if (i % 3 == 0) { @:<tr> } <td><a href="@url[i]"><img height="@(48 * scale.value)" width="@(48 * scale.value)" src="/i@(scale.value)/@(items[i]).png"/><span>@text[i]</span></a></td> if (i % 3 == 2) { @:</tr> } }
here introduction razor syntax, but:
use @: operator or
<text>
element. @: outputs single line of content containing plain text or unmatched html tags; element encloses multiple lines output. these options useful when don’t want render html element part of output.
i don't know, why <text>
working. maybe because razor still rc, not release
Comments
Post a Comment