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

[Solved] error: '$.telerik.datetime' is null or not an object

2 Answers 141 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Reid
Top achievements
Rank 2
Reid asked on 26 May 2011, 06:54 PM
I am getting this error when a View loads that has a MVC Calendar on it.

"Microsoft JScript runtime error: '$.telerik.datetime' is null or not an object"


Here is the markup ..

<%= Html.Telerik().Calendar()  
 .Name("Calendar")              
 .Value((DateTime)ViewData["selectedDate"])  
 .MinDate((DateTime)ViewData["minDate"])  
 .MaxDate((DateTime)ViewData["maxDate"])               
%> 

I have this at the bottom of the MasterPage

<% Html.Telerik().ScriptRegistrar()
          .DefaultGroup(group => group.DefaultPath("~/Scripts")          
                .Add("telerik.calendar.js")
               .Add("telerik.common.js")
               .Add("telerik.common.min.js")
               .Add("telerik.datepicker.js")
               .Add("telerik.datepicker.min.js")
               .Add("telerik.grid.editing.js")
               .Add("telerik.grid.editing.min.js")
               .Add("telerik.grid.filtering.js")
               .Add("telerik.grid.filtering.min.js")
               .Add("telerik.grid.grouping.js")                 
               .Add("telerik.grid.js")
               .Add("telerik.grid.min.js")
               .Add("telerik.menu.js")
               .Add("telerik.menu.min.js")
               .Add("telerik.numerictextbox.js")
               .Add("telerik.panelbar.js")
               .Add("telerik.panelbar.min.js")
               .Add("telerik.tabstrip.js")
               .Add("telerik.tabstrip.min.js")
               .Add("telerik.textbox.js")
               .Add("telerik.textbox.min.js")
               .Add("telerik.treeview.js")
               .Add("telerik.treeview.min.js")
               .Combined(true)
               .CacheDurationInDays(365)
               .Compress(true)                         
               
              )       
              .jQuery(false)       
              .Render();   
  %>
   <%= Html.Telerik().StyleSheetRegistrar()
     .DefaultGroup(group => group.DefaultPath("~/Content/css")                         
     .Add("telerik.common.css")                                                                       
     .Combined(true)                          
     .Compress(true))                     
     %>

Here is the Web.Config (II7)
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
      <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
        <add name="AssetHandler" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc"/>
   </handlers>
  </system.webServer>



Any suggestions how to cure this would be great.


Thanks,

Reid

2 Answers, 1 is accepted

Sort by
0
nachid
Top achievements
Rank 1
answered on 27 May 2011, 09:41 AM
$.telerik.datetime is a function defined in telerik.common.js
I can see however you've already included this file

I can also see that you are adding for each file, the normal and the min version.
There is no need to add the min version.
ScriptRegistrar is able to minify automatically when you deploy your project in non debug mode

On the hand, there is also no need to add all these files to your ScriptRegistrar
Normally when you add a component like Html.Telerik().Calendar()corresponding files are added automatically for you.
0
Reid
Top achievements
Rank 2
answered on 27 May 2011, 02:01 PM
HI Nachid,

Thank you for responding.  I did not know the distinction between the .min. and the non /min. version of JS files.

I have commented out the entire ScriptRegistrar and StyleSheetRegistrar section from the MasterPage and am still getting the error.  The Parent page and the embedded UserControls import the Telerik.Web.Mvc namespace.

Do you know of a way during debugging to see all the .js files that have been sent to the client?  My point being maybe somehow the telerik.common.js file is not being loaded. At this point I have no path to resolve it.


Thanks again,
Reid
Tags
Calendar
Asked by
Reid
Top achievements
Rank 2
Answers by
nachid
Top achievements
Rank 1
Reid
Top achievements
Rank 2
Share this question
or