MVC5此语句@Html.Raw(“ul class=”Html.DisplayFor(modelItem=>;item1.circleLevel)&“x27;”中存在错误
当我编译代码时,这一行出现语法错误 @Html.Raw(“item1.circlelelevel)”>) 我不知道如何纠正它MVC5此语句@Html.Raw(“ul class=”Html.DisplayFor(modelItem=>;item1.circleLevel)&“x27;”中存在错误,html,asp.net-mvc-5,Html,Asp.net Mvc 5,当我编译代码时,这一行出现语法错误 @Html.Raw(“item1.circlelelevel)”>) 我不知道如何纠正它 int num = 0; foreach (var item1 in Model) { if (num != item1.level) { num = item1.level; @Html.Raw("<ul class=\"@Html.DisplayFor(modelI
int num = 0;
foreach (var item1 in Model)
{
if (num != item1.level)
{
num = item1.level;
@Html.Raw("<ul class=\"@Html.DisplayFor(modelItem => item1.circleLevel)\">")
foreach (var item in Model)
{
if (item1.level == item.level)
{
<li>
<a class="text" style="background-color: @Html.DisplayFor(modelItem => item.IsExest)" href="@Url.Action("Details", "Tree", new { id = item.User_ID })">@Html.DisplayFor(modelItem => item.Name)</a>
</li>
}
}
<li>
<div class="text" data-toggle="tooltip" data-placement="left" title="add family member">@Html.ActionLink("+", "Create")</div>
</li>
<ul class="circle5"></ul>
}
}
@Html.Raw("</ul>")
}
int num=0;
foreach(模型中的var项1)
{
如果(num!=item1.level)
{
num=item1.level;
@Html.Raw(“”)
foreach(模型中的var项目)
{
if(item1.level==item.level)
{
-
}
}
-
@ActionLink(“+”,“Create”)
}
}
@Html.Raw(“
”)
}
出现了什么错误?(CS1003:语法错误,,“应为”)这是错误为什么使用@Html.Raw()
?只需
我想在foreach外部关闭ul标签,这样圆的形状就彼此上方,这是没有意义的-您需要平衡(相等数量的)
和
。现在还不清楚你想要实现什么。