对象不支持属性或方法' kendoDatePicker'

时间:2015-02-13 16:00:33

标签: c# model-view-controller kendo-ui telerik

我使用MV5 Razor创建了一个新项目,但我无法运行" @(Html.Kendo()。DatePicker()。名称(" datapickerTest"))&# 34;在我的主页视图中,我包含了" Kendo .js"和" jquery 2.1.3",但不起作用。

参考" Kendo.Mvc"包括在项目中。

BundleConfig.cs:

    public class BundleConfig
{
    // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-2.1.3.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

        bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                  "~/Scripts/bootstrap.js",
                  "~/Scripts/respond.js"));

        bundles.Add(new StyleBundle("~/Content/css").Include(
                  "~/Content/bootstrap.css",
                  "~/Content/site.css"));

        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
        "~/Scripts/kendo/kendo.all.min.js",
        "~/Scripts/kendo/kendo.timezones.min.js",
        "~/Scripts/kendo/kendo.aspnetmvc.min.js"));

        bundles.Add(new StyleBundle("~/Content/kendo/css").Include(
        "~/Content/kendo/kendo.common-bootstrap.min.css",
        "~/Content/kendo/kendo.common.min.css",
        "~/Content/kendo/kendo.default.min.css",
        "~/Content/kendo/kendo.dataviz.min.css",
        "~/Content/kendo/kendo.dataviz.default.min.css",
        "~/Content/kendo/kendo.bootstrap.min.css"));

        bundles.IgnoreList.Clear();

        // Set EnableOptimizations to false for debugging. For more information,
        // visit http://go.microsoft.com/fwlink/?LinkId=301862
        BundleTable.EnableOptimizations = true;
    }
}

_Layout.cshtml:

@Styles.Render("~/Content/css")
@Styles.Render("~/Content/kendo/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/kendo")
@Scripts.Render("~/bundles/modernizr")

1 个答案:

答案 0 :(得分:1)

解决。我在“_Layout.cshtml:”页面的页脚创建了这个“@ Scripts.Render(”〜/ bundles / jquery“)”