2016-12-11 3 views
1

Ich habe zwei Registerkarten, eine ist "Compras" und andere "Fiscal", wenn ich die Anwendung öffnen, wenn der Benutzer die Rolle "68" hat, sollte die Registerkarte Fiskal öffnen, sonst öffnen "Compras ", das Problem ist, dass die aktuelle Art und Weise, die ich mache, wenn ich den Tab Fiscal öffne, korrekt ausgewählt wird, aber es öffnet die Registerkarte Compras.Falsche Tab Öffnung mit Rasierer

Ich überprüfe hier die Erlaubnis des Benutzers.

ViewBag.isFiscal = false; 
        if (Web.Security.CustomPrincipal.CurrentUser().IsAuthenticated) 
        { 
         if (Web.Security.CustomPrincipal.CurrentUser().IsInRole("68")) 
         { 
          ViewBag.isFiscal = true; 
         } 
        } 

Und hier ich versuche, die Registerkarte Fiscal zu öffnen:

<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> 

Aber wenn ich mit einem Benutzer öffnen, die Rolle hat 68 öffnet es wie folgt aus: enter image description here

Es markiert Fiscal , aber der Inhalt des Formulars stammt aus dem Formular Compras, das korrekte Fiscal ist das: enter image description here

Som Weiß ich, was ich vermisse?

Antwort

0

Ich fand die Lösung.

Ich war den Tag nur aktiv in Tab Compras setzen, und ich jetzt eine Überprüfung den Tag aktiv in Compras zu setzen oder Geschäft

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