我在这里查看用户的许可。
ViewBag.isFiscal = false;
if (Web.Security.CustomPrincipal.CurrentUser().IsAuthenticated)
{
if (Web.Security.CustomPrincipal.CurrentUser().IsInRole("68"))
{
ViewBag.isFiscal = true;
}
}
在这里,我尝试打开财政标签:
<ul class="nav nav-tabs">
<li class="@(ViewBag.isFiscal == false ? "active" : "" )">
<a data-toggle="tab" href="#compras" data-etapa="78">Compras</a>
</li>
<li class="@(ViewBag.isFiscal == true ? "active" : "" )">
@if (Model != null && Model.IdTemplate > 0)
{
<a data-toggle="tab" href="#fiscal" data-etapa="80">Fiscal</a>
}
else
{
<a href="javascript:void(0);">Fiscal</a>
}
</li>
</ul>
它标记为Fiscal,但表单的内容来自Compras表单,正确的Fiscal是这样的:
有人知道我错过了什么吗?
答案 0 :(得分:0)
我找到了解决方案。
我只是在标签Compras中激活标签,现在我进行验证以将标签激活在Compras或财务中
<div id="compras"class="tab-pane @( (bool)Session["isFiscal"] == false ? "active" : "" )">
@*<div id="compras" class="tab-pane active">*@
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @class = "form-horizontal form-compras", id = "frmSaveCompras", action = string.Format("{0}/home/index", pathRoot) }))
{
@Html.Partial("_abaCompra", Model, ViewData)
}
</div>
@if (Model != null && Model.IdTemplate > 0)
{
<div id="contabil" class="tab-pane">
@using (Html.BeginForm("AbaContabil", "Home", FormMethod.Post, new { @class = "form-horizontal form-contabil", id = "frmSaveContabil", action = string.Format("{0}/home/AbaContabil", pathRoot) }))
{
@Html.Action("AbaContabil", "home", new { id = Model.IdItem, partial = (bool)ViewBag.partial, hash = (string)ViewBag.hash })
}
</div>
<div id="fiscal" class="tab-pane @((bool)Session["isFiscal"] == true ? "active" : "" )">>
@Html.Action("AbaFiscal", "home", new { id = Model.IdItem, partial = (bool)ViewBag.partial, hash = (string)ViewBag.hash })
</div>
}