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

[Solved] Uncaught TypeError: Cannot call method 'toLowerCase' of undefined

2 Answers 143 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matthew Noonan
Top achievements
Rank 1
Matthew Noonan asked on 10 Jun 2011, 06:18 PM
I upgraded a project I was working on to the latest extensions (2011.1.315, using NuGet), and now I am getting this error. I was able to reproduce the error in an example project (see attached).


VS2010 SP1
MVC 3 w/ Razor
Telerik.Web.Mvc 2011.1.315.340
jQuery 1.5.1

My example _Layout.cshtml page:
@using Telerik.Web.Mvc.UI;
 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    @(Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                          //.Add("telerik.examples.css")
                          .Add("telerik.common.css")
                          .Add("telerik.Windows7.css")
                          .Add("telerik.rtl.css")
                          .Combined(true)
                          .Compress(true))
      )
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <!--script src="@Url.Content("~/Scripts/jquery-1.6.1.min.js")" type="text/javascript"></script-->
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>
<body>
    <div class="page">
        <header>
            <div id="title">
                <h1>My MVC Application</h1>
            </div>
            <div id="logindisplay">
                @Html.Partial("_LogOnPartial")
            </div>
            <nav>
                <ul id="menu">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("About", "About", "Home")</li>
                </ul>
            </nav>
        </header>
        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
 @(Html.Telerik().ScriptRegistrar()
        //.jQuery(false)
  )
</body>
</html>

I have included a screen shot from Chrome with the exception. Anyone have any ideas?

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 13 Jun 2011, 08:50 AM
Hello Matthew Noonan,

 
After further investigation we noticed that DIV wrapper has same ID as the input element. Here is the code which causes this:

...
.Name("txtEntryDate")
.HtmlAttributes(new { id = "txtEntryDate" })
...
With Name  method is set ID and name to the input element and with the HtmlAttributes is applied same ID to the DIV wrapper, which is incorrect. In order to avoid this behavior I will suggest you set different id of the DIV:
@(Html.Telerik().DatePicker()
            .Name("txtEntryDate")
            .HtmlAttributes(new { id = "txtEntryDate_wrapper" })
            .ShowButton(true)
            .Value(DateTime.Now)
            )

You can check this online demo, which uses the same approach. 

This error is caused because some breaking changes which was introduced in Q1 2011. Check this help topic for more information.

Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Matthew Noonan
Top achievements
Rank 1
answered on 14 Jun 2011, 04:51 AM
That worked. Thanks!
Tags
Date/Time Pickers
Asked by
Matthew Noonan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Matthew Noonan
Top achievements
Rank 1
Share this question
or