Javascript error using RadEditor

7 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    4 posts
    Member since:
    Sep 2011

    Posted 04 Jun 2012 Link to this post

    Hi,
    I have used RadEditor in my project and created a demo page using the following HTML and  toolkit.xml
    Error is  "Uncaught TypeError: Cannot read property 'length' of undefined "

    HTML is :

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>


    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!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">
        <title></title>
        <script language="javascript" type="text/javascript">
            function OnClientShow(editor, args) {
                //alert(editor.get_id());
                editor.onParentNodeChanged();
                var style = editor.get_contentArea().style;
                style.backgroundImage = "none";
                style.backgroundColor = "white";
                style.minHeight = "100px";
                //style.min-height = "200px";
            }
            function loadGallery(s) {
                alert(s);
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
            </Scripts>
        </telerik:RadScriptManager>
        <div>
            <%-- AutoResizeHeight="True" 
        EditModes="Design, Html" ContentAreaMode="Div" ContentFilters="None" ToolsFile="~/toolfile.xml" Runat="server" 
        min-height="200px" OnClientLoad="OnClientShow" Height="100%" Width="99%" --%>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <telerik:RadEditor ID="RadEditor1"  AutoResizeHeight="True" 
        EditModes="Design, Html" ContentAreaMode="Div" ContentFilters="None" ToolsFile="~/toolfile.xml" Runat="server" 
        min-height="200px" OnClientLoad="OnClientShow" Height="100%" Width="99%">
                    </telerik:RadEditor>
                    
                    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>

    When i click on button then it will show an error on in javascript and "Font-size" and "Font-name" goes disable .
    Please reply . I am waiting for answer.


  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 06 Jun 2012 Link to this post

    Hi,

    The provided example is not full and I was unable to reproduce the problem. Please, open a support ticket and provide a fully runnable project that demonstrates your scenario so that I can reproduce the problem, research it and provide a solution. You did not also specify the browser version under which the problem exists.

    My suggestion is to recreate the problem with the latest version of RadControls for ASP.NET AJAX too.


    Greetings,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Okey
    Okey avatar
    1 posts
    Member since:
    Jun 2011

    Posted 03 Jul 2012 Link to this post

    Hey,

    I just personally came across this problem and found a fix.

    If the html <head> tag has runat="server", radscriptmanager processes some styling on it and fails - this causes other issues for me (loading panels wouldn't show properly, etc).  Example of the  error call stack I received.

    1. Uncaught TypeError: Cannot read property 'length' of null Telerik.Web.UI.WebResource.axd:7809
      1. Telerik.Web.UI.RadAjaxControl.updateHeadStylesTelerik.Web.UI.WebResource.axd:7809
      2. Telerik.Web.UI.RadAjaxControl.set_stylesTelerik.Web.UI.WebResource.axd:7608
      3. Sys$Component$_setPropertiesTelerik.Web.UI.WebResource.axd:6
      4. (anonymous function)profile.aspx:2
      5. Sys._Application.add_initTelerik.Web.UI.WebResource.axd:6
      6. (anonymous function)profile.aspx:1
      7. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
      8. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
      9. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
      10. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
      11. Sys._ScriptLoader._nextSessionTelerik.Web.UI.WebResource.axd:15
      12. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
      13. Sys._ScriptLoader._scriptLoadedHandlerTelerik.Web.UI.WebResource.axd:15
      14. Sys._ScriptLoaderTask._scriptLoadHandlerTelerik.Web.UI.WebResource.axd:6
      15. b


    I'm not an expert, so I'm not sure if the html head tags needs to runat the server or if the radscriptmanager needs it there, but since I removed it, everything has been operating without errors. I did some exploring on other blogs and found that running this at the server makes it's objects available to server side code, etc, but can cause some scoping errors because it's being processed in another thread and may be unavailable at the time needed by objects on the page.

    Just thought I'd pass this along.
  5. Max
    Max avatar
    4 posts
    Member since:
    Jun 2013

    Posted 23 Jun 2013 Link to this post

    Huge thank you 2 Okey I ran into the exact same issue and it was fixed as soon as I removed the runat server tag for the head of my masterpage. 

    Hopefully Telerik has addressed this in future versions.
  6. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 26 Jun 2013 Link to this post

    Hello Max,

    Could you confirm whether your version of RadControls is the latest one (currently this is version 2013.2.611), and if not does upgrading to it resolve your issue?

    If the above step, however, is not helpful, could you please open a support ticket and send us a fully runnable sample with reproduction steps of the issue, so that we can make a further research locally?

    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Brian Garson
    Brian Garson avatar
    54 posts
    Member since:
    Jan 2008

    Posted 08 Apr 2015 in reply to Okey Link to this post

    I'm getting this same issue with a new page that I'm building.  I have a RadAjaxManager and it occurs after an ajaxRequest is made.  The JS function in the response scripts of the radAjaxManager still works, however it throws an exception on the page causing the ajaxManager to not work for a 2nd fire.

     

     

     

     

  8. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 09 Apr 2015 Link to this post

    Hello Brian,

    Without reproducing the issue locally it would be hard to tell what may be causing it.

    I would suggest that you open a support ticket and send us a small fully runnable sample that reproduce the unexpected behavior, so that we can proceed further with the investigation.

    Regards,
    Danail Vasilev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017