拥有此代码。分解为cs1002异常:"预期;"。我做错了什么?
<%
foreach (var rubric in RubricTreeView.Nodes)
{ %>
<div class="rubric-list-item top-level" data-id="<%rubric.Id%>">
<span class="rubric-list-chb">
<input type="checkbox" id="chb<%rubric.Id%>" />
<label class="checkbox-skin" for="chb<%rubric.Id%>"></label>
</span>
<span class="rubric-list-marker active"></span>
<%rubric.Title%>
</div>
<% if (rubric.SubNodes.Any())
{ %>
<div class="rubric-list-subitems">
<% foreach (var subRubric in rubric.SubNodes)
{%>
<div class="rubric-list-item active">
<span class="rubric-list-chb">
<input type="checkbox" id="chb<%subRubric.Id%>" />
<label class="checkbox-skin" for="chb<%subRubric.Id%>"></label>
</span>
<span class="rubric-list-marker"></span>
<%subRubric.Title%>
</div>
<%} %>
</div>
<% } %>
<% } %>
可能&lt;%subRubric.Title;%&gt; ?
答案 0 :(得分:3)
您应该使用:
<%= rubric.Title %>
和
<%= subRubric.Title %>
并且在一些地方
<%= rubric.Id %>
否则,内部代码将被评估为代码块,这意味着它需要;
。