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

unable to resolve "Telerik is not defined"

6 Answers 1393 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Hans Petter Evju
Top achievements
Rank 1
Hans Petter Evju asked on 25 Mar 2010, 03:34 PM
I'm testing out Telerik in a vs2010/mvc2 application. I've created an mvc2 application from a blank template, then added telerik by using telerik_convert to...

I'm currently trying to add a RadEditor to one of my views. I've changed 2 lines in the root web.config file, but nothing in the views\web.config file.
Under httphandlers (aspx to axd):
            <add path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
Under handlers (aspx to axd):
            <add name="Telerik_Web_UI_DialogHandler_axd" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" />

My routing should be ok:
       public static void RegisterRoutes(RouteCollection routes)  
        {  
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  
  
            routes.MapRoute(  
                "Default",                                              // Route name  
                "{controller}/{action}/{id}",                           // URL with parameters  
                new { controller = "Default", action = "Index", id = "" }  // Parameter defaults  
            );  
        }  


The code from the view:
            <div class="editor-label"
                <%= Html.LabelFor(model => model.Content) %> 
            </div> 
            <div class="editor-field"
                <form> 
                <
                  RadEditor1.Content = Model.Content; 
                %> 
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/> 
                 <telerik:RadEditor runat="server" ID="RadEditor1" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"/> 
                <%= Html.ValidationMessageFor(model => model.Content) %> 
                </form> 
            </div> 


The editor shows, but firebug reports:  "Telerik is not defined" and nothing works within the editor.

edit: I have the entire project + db zip'ed upp if needed.

6 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 26 Mar 2010, 04:02 PM
Hello Hans Petter Evju,

You should also register the Telerik.Web.UI.WebResource.axd handler as well

<add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode,runtimeVersionv2.0"/>

I hope this helps.

Sincerely yours,
Tsvetomir Tsonev
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
Hans Petter Evju
Top achievements
Rank 1
answered on 08 Apr 2010, 10:01 AM
Not really, since those already are in my web.config file.

<?xml version="1.0"?> 
<!-- 
  For more information on how to configure your ASP.NET application, please visit 
  http://go.microsoft.com/fwlink/?LinkId=152368 
  --> 
<configuration> 
    <connectionStrings> 
  <add name="publishingConnectionString" connectionString="Data Source=.;Initial Catalog=publishing;Integrated Security=True;Pooling=False" 
   providerName="System.Data.SqlClient" /> 
 </connectionStrings> 
 <system.web> 
        <compilation debug="true" targetFramework="4.0"
            <assemblies> 
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
            </assemblies> 
        </compilation> 
        <authentication mode="Forms"
            <forms loginUrl="~/Account/LogOn" timeout="2880" /> 
        </authentication> 
        <pages> 
            <namespaces> 
                <add namespace="System.Web.Mvc" /> 
                <add namespace="System.Web.Mvc.Ajax" /> 
                <add namespace="System.Web.Mvc.Html" /> 
                <add namespace="System.Web.Routing" /> 
        <add namespace="Telerik.Web.Mvc.UI" /> 
            </namespaces> 
        <controls> 
            <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" /> 
    </controls> 
        </pages> 
        <httpHandlers> 
            <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
            <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" /> 
            <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" /> 
            <add path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" /> 
            <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" /> 
            <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" /> 
            <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" /> 
        </httpHandlers> 
    <httpModules> 
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" /> 
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression" /></httpModules
    </system.web> 
    <system.webServer> 
        <validation validateIntegratedModeConfiguration="false" /> 
        <modules runAllManagedModulesForAllRequests="true"
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode,runtimeVersionv2.0" /></modules
        <handlers> 
            <remove name="MvcHttpHandler" /> 
            <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
            <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="Telerik_Web_UI_DialogHandler_axd" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
            <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" /> 
        </handlers> 
    </system.webServer> 
    <runtime> 
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
            <dependentAssembly> 
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
                <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" /> 
            </dependentAssembly> 
        </assemblyBinding> 
    </runtime> 
<appSettings> 
    <add key="Telerik.Skin" value="WebBlue" /> 
    <add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" /> 
    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" /> 
    </appSettings> 
</configuration> 
 

0
T. Tsonev
Telerik team
answered on 09 Apr 2010, 10:42 AM
Hi Hans,

Try moving the RadScriptManager to the bottom of the page. This should fix the issue.

Sincerely yours,
Tsvetomir Tsonev
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
Hans Petter Evju
Top achievements
Rank 1
answered on 09 Apr 2010, 10:52 AM
I tried to move it to the bottom of the page (below the </html> tag) with no luck, I also tried to place it just above the </body> tag with no luck. here is the modified masterpage:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <link href="/Content/ui-lightness/jquery-ui-1.8.custom.css" rel="stylesheet" type="text/css" /> 
    <link href="/Content/treeview/jquery.treeview.css" rel="stylesheet" type="text/css" /> 
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title
    <script src="/Scripts/jquery-1.4.2.min.js" type="text/javascript"></script> 
    <asp:ContentPlaceHolder ID="CssJsContent" runat="server" /> 
 
</head> 
<body> 
    <div> 
        <asp:ContentPlaceHolder ID="MainContent" runat="server"
        </asp:ContentPlaceHolder> 
    </div> 
    <script src="/Scripts/interface.js" type="text/javascript"></script> 
    <script src="/Scripts/jquery-ui-1.8.custom.min.js" type="text/javascript"></script> 
    <script src="/Scripts/custom/menu.js" type="text/javascript"></script> 
    <script src="/Scripts/jquery.jeditable.mini.js" type="text/javascript"></script> 
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/>  
</body> 
</html> 
 

And the modified aspx page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MainMaster.Master" Inherits="System.Web.Mvc.ViewPage<publisher.Models.MenuDB.MenuModelItem>" %> 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"
 
<h2>Details</h2> 
 
<fieldset> 
    <legend>Fields</legend> 
     
    <div class="display-label">Name</div> 
    <div class="display-field">  
    <form>  
                <%  
                    RadEditor1.Content = Model.Name;  
                %>  
                 <telerik:RadEditor runat="server" ID="RadEditor1" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"/>  
                <%= Html.ValidationMessageFor(model => model.Name) %>  
                </form>  
    </div> 
     
    <div class="display-label">Id</div> 
    <div class="display-field"><%= Html.Encode(Model.Id) %></div
     
    <div class="display-label">ParentId</div> 
    <div class="display-field"><%= Html.Encode(Model.ParentId) %></div
     
</fieldset> 
<p> 
    <%=Html.ActionLink("Back to List", "Index", null, new { onClick = @"return closeModal();" })%> 
</p> 
 
</asp:Content> 
 

0
Accepted
T. Tsonev
Telerik team
answered on 15 Apr 2010, 09:42 AM
Hello Hans,

Apologies for the late response. I'm sending you a sample (minimal) project with RadEditor in an MVC2 application. Give it a try and let us know if it works on your end.

Greetings,
Tsvetomir Tsonev
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
Hans Petter Evju
Top achievements
Rank 1
answered on 15 Apr 2010, 12:01 PM
That did the trick, and after having done some more research I found the culprit. By removing the following code from my web.config it started working, see commented line. 

  <appSettings> 
    <add key="Telerik.Skin" value="WebBlue" /> 
    <!--<add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />--> 
    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" /> 
  </appSettings> 

Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Hans Petter Evju
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Hans Petter Evju
Top achievements
Rank 1
Share this question
or