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

[Solved] ScriptRegistrar not loading telerik.common.min.js

7 Answers 233 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Donna Stewart
Top achievements
Rank 1
Donna Stewart asked on 08 Sep 2010, 04:47 PM
In my application I am using nested master pages.  I have the Site.Master, PublicSite.master used for the public side of the site and, SecureSite.master used obviously for the secure side of the app.  I have the ScriptRegistrar statement in Site.Master.  The public side works like a charm.  I am now beginning to code the secure side.  I have a log on view which uses the PublicSite.master and once the user is validated I go to a secure view which uses the SecureSite.master.  Here is where the issue lies - for some reason when the app routes to the secure side, the ScriptRegistrar does not load the telerik.common.min.js and I am getting errors for the other telerik javascript files I add using the ScriptRegistrar statement.  I am getting Microsoft JScript runtime error: 'undefined' is null or not an object and it breaks at the telerik.combobox.min.js line 1

 

function(a){var b=a.telerik;b.combobox=function(c,d) ...
 b is undefined
I am using the latest version of Telerik MVC Extensions - 2010.2.825.  I am getting the errors in IE and Firefox.
I can continue on to the secure view and here is the rendered html which shows the telerik.common.min.js is not loading:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head><script type="text/javascript" src="http://ajax.microsoft.com/ajax/4.0/1/globalization/en-US.js"></script><title>
      
  
</title><link href="../../Content/Site.css" rel="stylesheet" type="text/css" /><link type="text/css" href="/Content/2010.2.825/telerik.common.min.css" rel="stylesheet"/>
<link type="text/css" href="/Content/telerik.gmctelerik.css" rel="stylesheet"/>
</head  
<body>
    <div  
       <h2>Hello Donna Stewart from </h2>
   </div
<script type="text/javascript" src="/Scripts/2010.2.825/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.combobox.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.list.min.js"></script>
<script type="text/javascript" src="/Scripts/curvycorners.src.js"></script>
 
</body>
</html>

Site.Master
<%@ Master Language="VB" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%-- The following line works around an ASP.NET compiler warning --%>
<%: ""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head runat="server">
    <%: Ajax.GlobalizationScript()%>
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <%= Html.Telerik().StyleSheetRegistrar() _
             .DefaultGroup(Function(group) group.Add("telerik.common.min.css")) _
             .DefaultGroup(Function(group) group.Add("telerik.gmctelerik.css"))
    %>
</head>
<body>
    <div>
        <asp:ContentPlaceHolder ID="MainContent" runat="server" />
    </div>
    <%= Html.Telerik.ScriptRegistrar().Scripts(Function(s) s.Add("/2010.2.825/telerik.combobox.min.js")) _
         .Scripts(Function(s) s.Add("/2010.2.825/telerik.list.min.js")) _
         .Scripts(Function(s) s.Add("/curvycorners.src.js"))
    %>
</body>
</html>

SecureSite.master
<%@ Master Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewMasterPage"%>
<%@ Import Namespace="gmcps" %>
<%@ Import Namespace="GMCResources.My.Resources" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ContentPlaceHolder ID="SecureContent" runat="server" />
</asp:Content>

Controller code which redirects to the view using SecureSite.master:
<HttpPost()> _
Public Function LogOn(ByVal model As LogOnModel, ByVal returnUrl As String) As ActionResult
    If ModelState.IsValid Then
        Dim userInfo As New PersistentUserInfo
        Dim companyCodeToUse As Integer
        If model.CustCarrierFlag Then
            companyCodeToUse = model.CarrierCode
        Else
            companyCodeToUse = model.CompanyCode
        End If
        model.carrierList = New List(Of web_CarrierListResult)
        model.carrierList = Session("carrierList")
        If MembershipService.ValidateUser(companyCodeToUse, model.CustCarrierFlag, model.UserName, model.Password, userInfo) Then
            FormsService.SignIn(model.UserName, model.RememberMe)
            Session("GMCUserInfo") = userInfo
            If Not String.IsNullOrEmpty(returnUrl) Then
                Return Redirect(returnUrl)
            Else
                Return RedirectToAction("Operations", "Operations")
            End If
        Else
            ModelState.AddModelError("", "The user name or password provided is incorrect.")
        End If
    End If
    ' If we got this far, something failed, redisplay form
    Return View(model)
End Function

OperationsController:
Imports com.gmcps.Membership
Public Class OperationsController
    Inherits BaseController
    '
    ' GET: /Operations
    Function Operations() As ActionResult
        Dim userInfo As PersistentUserInfo = Session.Item("GMCUserInfo")
        Return View(userInfo)
    End Function
End Class

Any help is very much appreciated!

7 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 08 Sep 2010, 04:58 PM
Hello Donna Stewart,

Could you please try to use DefaultGroup() method, instead of Scripts?

If the problem still persists I will ask you to send us a simple test project, which reproduces the depicted issue. Thus we will review it locally and advice you further.

Best wishes,
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
Donna Stewart
Top achievements
Rank 1
answered on 08 Sep 2010, 05:33 PM

I changed Scripts to DefaultGroup as follows and it is not working at all now - getting errors right off the bat:

<%= Html.Telerik.ScriptRegistrar().DefaultGroup(Function(s) s.Add("/2010.2.825/telerik.combobox.min.js")) _
            .DefaultGroup(Function(s) s.Add("/2010.2.825/telerik.list.min.js")) _
            .DefaultGroup(Function(s) s.Add("/curvycorners.src.js"))

It is loading the added scripts before the default ones - here's the rendered html:
<script type="text/javascript" src="/Scripts/2010.2.825/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.combobox.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.list.min.js"></script>
<script type="text/javascript" src="/Scripts/curvycorners.src.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.common.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.menu.min.js"></script>

I am sure I am doing something wrong - please any advice you can give is appreciated!

Thank you,
Donna
0
Georgi Krustev
Telerik team
answered on 09 Sep 2010, 11:47 AM
Hello Donna Stewart,

Depending on the given information is hard to determine where could be the problem. Could you please provide a simple test project which reproduces the problem Thus I will be able to review it locally and advice you further.

Greetings,
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
Donna Stewart
Top achievements
Rank 1
answered on 09 Sep 2010, 03:49 PM
I opened a support ticket with the attached zip of the test project.  The ticket number is 346711.

Thanks,
Donna
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Sep 2010, 05:54 PM
Hello Donna Stewart,

Here is a quote of the answer of the support thread:

telerik.common.js file, as other Telerik javascript files will be added to page only if there is a component which requires them. So this is by design.
The difference between DefaultGroup and Scripts method is that:
  • DefaultGroup uses already created default group to add scripts to it. So if you need to allow ScriptRegistrar to load telerik.common.js, telerik.list.js, but you need to also load javascript file in the same group, then you need to use DefaultGroup method.
  • Scripts method creates different groups for the added scripts, but in general works as DefaultGroup method.

As a side note, if component is loaded with ajax its javascript files will not be loaded, because MS Ajax does not evaluated Javascript and CSS files on ajax.

So, to generalize, the observed behavior is expected if there is no Telerik components rendered on page (not using ajax),


Kind 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
Donna Stewart
Top achievements
Rank 1
answered on 09 Sep 2010, 05:58 PM
Thank you Georgi.  I have added telerik.common.min.js to the ScriptRegistrar.DefaultGroup statement in my Site.Master and it works, even for the issue in my original post.  So the answer is to use DefaultGroup instead of Scripts and include telerik.common.min.js as one of the script files you add using DefaultGroup.

Thank you for your information and help!
Donna
0
Naeem
Top achievements
Rank 1
answered on 01 Apr 2013, 09:39 PM
Hi ,

I am facing the same issue, using Ajax call to render the telerik grid . getting java script error object does not support the property . Telerik.common.min.js , issue is only coming in ie.
 

The above solution provided by you  is for telerik render (without Ajax call) , what about ajax call rendering.
Tags
General Discussions
Asked by
Donna Stewart
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Donna Stewart
Top achievements
Rank 1
Naeem
Top achievements
Rank 1
Share this question
or