2012-09-03 15 views
0

我有一個顯示多個選項卡的主頁。錯誤數據顯示在標籤下mvc3

我想在頁面中爲第一個標籤 添加標籤,我正在使用jquery和ajax調用,其中標籤計數取決於 獲取的數據。

例如,我的家庭控制器有更多的細節動作,顯示 產品,製造商的標籤,並在產品標籤取決於獲取DAT 我顯示國家的標籤和第一個標籤工作正常,並在第二個選項卡 是從製造商選項卡獲取數據並且沒有數據顯示在 製造商選項卡下。

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<EmsAdmin.Models.abc>" %> 

ABC詳細 ABC詳細 <%Html.RenderPartial( 「ABC」,模型); %>

  • 產品
  • <%,如果((布爾)計算機[ 「HasWTB」]) //他們是否按產品有哪裏? {%>
  • <%}%>
  • 報告
  • <%如果((布爾型)計算機[ 「HasInText」]) {%>
  • 分類
  • <%}%>
  • 區域
  • </ul> 
        <div class="panes"> 
         <!-- Products --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Products"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of products--> 
         <% if ((Boolean)ViewData["HasWTB"]) 
          // Do they have the Where to by product? 
          { %> 
         <!-- where to buy --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Manufacturers"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of where to buy --> 
         <% } %> 
         <!-- Request Reports see Reports.ascx--> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Reports"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of request reports --> 
         <% if ((Boolean)ViewData["HasInText"]) 
          { %> 
         <!-- In Text --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("InText"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of in text --> 
         <% } %> 
         <!-- Ranges or SubBrands --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Ranges"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of ranges of SubBrands --> 
         <!-- Ranges or Region --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Regions"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of ranges of Regions --> 
         <!-- Categories --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("Categories"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end of Categories --> 
          <!-- REgions --> 
         <div class="pane"> 
          <div style="clear: both;"> 
           &nbsp;</div> 
          <% Html.RenderPartial("REgions"); %> 
          <div style="clear: both;"> 
           &nbsp;</div> 
         </div> 
         <!-- end ofFilters --> 
        </div> 
    </div> 
    <script type="text/javascript"> 
        //<![CDATA[ 
    
        // Set the tabs to be tabs 
        $(function() { 
         // setup ul.tabs to work as tabs for each div directly under div.panes 
         $("ul.tabs").tabs("div.panes > div"); 
        }); 
        //]]> 
    </script> 
    

    +0

    你是很好,足以表現出一點的代碼? –

    回答

    0

    我可能是錯的,但看起來像MVC 2代碼。

    有很多非常簡單的標籤的jQuery示例。這個使用MVC3和Razor的twitter引導程序。

    @model Layout.Models.DataModel 
    <script type="text/javascript"> 
    $(document).ready(function() { 
        // show the first tab 
        $('#homeTabs a:first').tab('show'); 
    });  
    </script> 
    <div class="container"> 
    <ul class="nav nav-tabs" id="homeTabs"> 
        <li><a href="#section11" data-toggle="tab">1.1</a></li> 
        <li><a href="#section12" data-toggle="tab">1.2</a></li> 
        <li><a href="#section13" data-toggle="tab">1.3</a></li> 
    </ul> 
    <div class="tab-content"> 
        <div class="tab-pane active" id="section11"> 
         @{ 
          Html.RenderPartial("Details.1.1", Model); 
         } 
        </div> 
        <!-- section11 end--> 
        <div class="tab-pane active" id="section12"> 
        </div> 
        <!-- section12 end--> 
        <div class="tab-pane active" id="section13"> 
        </div> 
        <!-- section13 end--> 
    </div> 
    <!-- tab-content end--> 
    </div> 
    <!-- container end--> 
    

    希望幫助