This is a migrated thread and some comments may be shown as answers.

Getting the "0x800a01b6" Error

6 Answers 441 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 04 Feb 2013, 09:18 PM

I followed the instructions here:
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction

But, I am still getting the following error:
0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'kendoDatePicker'

I think the problem is related to something VS2012 does when creating a Web Application for Mobile devices.

Here are the basic steps I followed:
Open VS 2012 > New Project > ASP.NET MVC 4 Web Application > Mobile Application > Then followed all the MVC 4 steps here (http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction)

Any help will be appreciated. My code is below.

BundleConfig.cs:

using System.Web;
using System.Web.Optimization;
 
namespace KendoMobileApp
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-1.*"));
 
            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui*"));
 
            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));
 
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));
 
            bundles.Add(new ScriptBundle("~/bundles/jquerymobile").Include("~/Scripts/jquery.mobile*"));
 
            bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
 
            bundles.Add(new StyleBundle("~/Content/mobilecss").Include("~/Content/jquery.mobile*"));
 
            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));
 
 
 
 
 
            // The jQuery bundle
            //bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            //                "~/Scripts/jquery-1.*"));
 
 
            // The Kendo JavaScript bundle
            bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                    "~/Scripts/kendo.web.*", // or kendo.all.* if you want to use Kendo UI Web and Kendo UI DataViz
                    "~/Scripts/kendo.aspnetmvc.*"));
 
 
            // The Kendo CSS bundle
            bundles.Add(new StyleBundle("~/Content/kendo").Include(
                    "~/Content/kendo.common.*",
                    "~/Content/kendo.default.*"));
 
 
            // Clear all items from the default ignore list to allow minified CSS and JavaScript files to be included in debug mode
            bundles.IgnoreList.Clear();
 
 
            // Add back the default ignore list rules sans the ones which affect minified files and debug mode
            bundles.IgnoreList.Ignore("*.intellisense.js");
            bundles.IgnoreList.Ignore("*-vsdoc.js");
            bundles.IgnoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
 
        }
    }
}

_Layout.cshtml
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title</title>
        <meta name="viewport" content="width=device-width" />
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        @Styles.Render("~/Content/mobileCss", "~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
        @Styles.Render("~/Content/kendo")
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/kendo")
 
    </head>
    <body>
        <div data-role="page" data-theme="b">
            <div data-role="header">
                <h1>@ViewBag.Title</h1>
            </div>
            <div data-role="content">
                @RenderBody()
            </div>
        </div>
 
        @Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile")
        @RenderSection("scripts", required: false)
    </body>
</html>

HomeController.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace KendoMobileApp.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
 
            return View();
        }
 
        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";
 
            return View();
        }
 
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
 
            return View();
        }
    }
}

Index.cshtml:
@{
    ViewBag.Title = "Home Page";
}
 
<h2>@ViewBag.Message</h2>
@(Html.Kendo().DatePicker().Name("Birthday"))
<p>
    To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc<;/a>.
</p>
 
<ul data-role="listview" data-inset="true">
    <li data-role="list-divider">Navigation</li>
    <li>@Html.ActionLink("About", "About", "Home")</li>
    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 05 Feb 2013, 08:29 AM
Hi Allan,

 You seem to have missed this required step:

Register the bundles in your layout page at the end of the head element. Remove any existing jQuery bundle registration at end of the body element of the page.

As a result jQuery is being rendered twice. The second instance wipes out any jQuery plugins registered beforehand which includes all Kendo UI widgets. To fix that simply delete the following line from your layout:

@Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile")

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Allan
Top achievements
Rank 1
answered on 05 Feb 2013, 01:44 PM
That gets rid of the bug.

But, those scripts are required for other aspects of the application.

I am not sure what to do now.
0
Accepted
Atanas Korchev
Telerik team
answered on 05 Feb 2013, 01:49 PM
Hello Allan,

 You already have the jQuery bundle rendered before the kendo ui one:

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/kendo")

So jQuery should be already available. You can also include jQuery mobile the same way.

Kind regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Allan
Top achievements
Rank 1
answered on 05 Feb 2013, 01:53 PM
I needed this tag:

@Scripts.Render("~/bundles/jquerymobile")
0
Allan
Top achievements
Rank 1
answered on 05 Feb 2013, 01:54 PM
Also, why can I not attach a zipped project over 2 MB to this thread?
0
steven
Top achievements
Rank 1
answered on 11 Feb 2015, 02:39 AM
POST MODERATED FOR USE OF FOUL LANGUAGE.
Tags
General Discussions
Asked by
Allan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Allan
Top achievements
Rank 1
steven
Top achievements
Rank 1
Share this question
or