Tabs in Razor only one tab is active

2019-09-19 12:01发布

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条回答
啃猪蹄的小仙女
2楼-- · 2019-09-19 12:24

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>
查看更多
登录 后发表回答