Tabs in Razor only one tab is active

半世苍凉 提交于 2019-12-13 08:13:51

问题


I have the following tabs in my Razor:

<div class="page-tabs">
<ul class="nav nav-tabs">
    @if (!Model.OriginalWork.IsNew)
    {

        <li class='@(ViewBag.IsAmendment == "0" ? "active" : "")'>
        <a href='@Url.Action("ReviewDetails", "SongsManagement", new { isAmendment = 0 }))' title="Original">Original</a>
    </li>
        <li class='@(ViewBag.IsAmendment == "1" ? "active" : "")'>
            <a href='@Url.Action("ReviewDetails", "SongsManagement", new { isAmendment = 1 })' title="Amendment">Active Amendment</a>
    </li>
    }
</ul>

Only the second tab is showing as active when I click on it. When I click on the original its not changing?


回答1:


In first tab there is an extra parenthesis

<div class="page-tabs">
<ul class="nav nav-tabs">
@if (!Model.OriginalWork.IsNew)
{

    <li class='@(ViewBag.IsAmendment == "0" ? "active" : "")'>
    <a href='@Url.Action("ReviewDetails", "SongsManagement", new { isAmendment = 0 
  })' title="Original">Original</a>
</li>
    <li class='@(ViewBag.IsAmendment == "1" ? "active" : "")'>
        <a href='@Url.Action("ReviewDetails", "SongsManagement", new { isAmendment = 1 })' title="Amendment">Active Amendment</a>
</li>
}
 </ul>


来源:https://stackoverflow.com/questions/51743347/tabs-in-razor-only-one-tab-is-active

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!