ASP.NET MVC/TabStrip-不切换选项卡 [英] ASP.NET MVC / TabStrip - Doesnt switch Tabs

查看:68
本文介绍了ASP.NET MVC/TabStrip-不切换选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)在bundle.config中包含了以下内容

1) included the following in bundle.config

/Content/kendo/kendo.common.min.css
/Scripts/modernizr-2.5.3.js 
/Scripts/jquery-1.7.1.js    
/Scripts/kendo/kendo.all.min.js
/Scripts/kendo/kendo.aspnetmvc.min.js   
/Content/kendo/kendo.common.min.css 
/Content/kendo/kendo.metro.min.css   
2) web.config 

      <namespaces>
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Optimization"/>
            <add namespace="System.Web.Routing" />
            <add namespace="Kendo.Mvc.UI" />
          </namespaces>

    3) .cshtml
    @using Kendo.Mvc.UI 
    <script>

        var onActivate = function (e) {
            // access the activated item via e.item (Element)

            // detach activate event handler via unbind()
            tabStrip.unbind("activate", onActivate);
        };
    </script>
    <div id="forecast">
        @(Html.Kendo().TabStrip()
              .Name("tabstrip")
              .Events(events => events
                .Select("onSelect")
                .Activate("onActivate")
                .ContentLoad("onContentLoad")
                .Error("onError")
             )
              .Items(tabstrip =>
              {
                  tabstrip.Add().Text("Paris")
                      .Selected(true)
                      .Content(@<text>
                        <div class="weather">
                            <h2>17<span>&ordm;C</span></h2>
                            <p>Rainy weather in Paris.</p>
                        </div>
                        <span class="rainy">&nbsp;</span>
                      </text>);

                  tabstrip.Add().Text("New York")
                        .Content(Html.Action("HandleTabStrip","Home").ToString()
                  );

                  tabstrip.Add().Text("Moscow")
                      .Content(@<text>
                        @Html.Action("HandleTabStrip", "Home")
                   </text>);

                  tabstrip.Add().Text("Sydney")
                      .Content(@<text>
                        <div class="weather">
                            <h2>17<span>&ordm;C</span></h2>
                            <p>Rainy weather in Sidney.</p>
                        </div>
                        <span class="rainy">&nbsp;</span>
                      </text>);
              })
        )
    </div>

HomeController 
----------------

  public ActionResult HandleTabStrip()
        {
            return View();
        }

问题是选项卡不切换.没有JS错误.它只是改变URL什么都不做 http://:55985/Home/AjaxBoundTabView#tabstrip-2 我已经花了将近2个星期,没有任何头绪.我只是按照文档中指定的步骤操作,但是不起作用

The problem is the tabs dont switch. No JS errors. it just changes url doing nothing http://:55985/Home/AjaxBoundTabView#tabstrip-2 I have spent close to 2 weeks without any clue. I just followed the steps specified in the documentation but it doesnt work

推荐答案

尝试更改jQuery版本. 1.7.1太旧了,您的Kendo UI版本可能不支持它.

Try changing the jQuery version. 1.7.1 is quite an old one and your Kendo UI version may not support it.

这篇关于ASP.NET MVC/TabStrip-不切换选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆