MVC5在这个语句中有一个错误@Html.Raw(&#34; <ul class =“@ Html.DisplayFor(modelItem =&gt; item1.circleLevel)”>&#34;)

时间:2018-04-22 07:21:10

标签: html asp.net-mvc-5

this how it looks when i run the code while ul closing inside for eachthis how it should look like 当我编译代码时,此行中出现语法错误 @ Html.Raw(&#34; item1.circleLevel)&#39;&gt;&#34;)  我不知道如何纠正它

    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>") 
}

0 个答案:

没有答案