错误的数据显示在选项卡mvc3下

时间:2012-09-03 14:59:16

标签: asp.net-mvc-3

我有一个主页,显示多个标签。

我正在尝试为第一个标签添加标签     在页面中,我使用jquery和ajax调用来执行此操作,其中选项卡计数取决于     获取的数据。

例如,我的家庭控制器显示详细信息操作     产品,制造商标签和产品下标签取决于获取的数据     我正在显示国家/地区选项卡,第一个选项卡工作正常,第二个选项卡     它从manufactrures选项卡中获取数据,并且没有显示数据     制造商标签。

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

     abc详情                         abc详情     &lt;%Html.RenderPartial(“abc”,Model); %GT;                           

  • 产品
  •             &lt;%if((Boolean)ViewData [“HasWTB”])                //他们有产品在哪里?                {%>             
  • 制造商
  •             &lt;%}%&gt;             
  • 报告
  •             &lt;%if((Boolean)ViewData [“HasInText”])                {%>             
  • 分类
  •             &lt;%}%&gt;             
  • 区域
  •     </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>
    

    1 个答案:

    答案 0 :(得分:0)

    我可能错了,但看起来像MVC 2代码。

    有很多非常简单的标签的jQuery示例。这个使用Twitter引导程序与MVC3和Razor。

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

    希望有所帮助