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

Javascript error using RadEditor

7 Answers 542 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 04 Jun 2012, 11:54 AM
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.


7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Jun 2012, 02:05 PM
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.
0
Okey
Top achievements
Rank 1
answered on 03 Jul 2012, 08:40 PM
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.
0
Max
Top achievements
Rank 1
answered on 23 Jun 2013, 04:52 PM
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.
0
Danail Vasilev
Telerik team
answered on 26 Jun 2013, 03:36 PM
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.
0
Brian Garson
Top achievements
Rank 2
answered on 08 Apr 2015, 07:54 PM

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.

 

 

 

 

0
Danail Vasilev
Telerik team
answered on 09 Apr 2015, 11:55 AM
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.

 
0
Sailaja
Top achievements
Rank 1
answered on 24 May 2017, 04:28 AM

Hi,

Getting the similar error while I am trying to change the font style and size in radeditor. This is happening when I use ContentAreaMode="Div".

Any suggestions please.

 

Uncaught TypeError: Cannot read property 'length' of undefined
    at Function.Sys.UI.DomEvent._removeHandler (Telerik.Web.UI.WebResource.axd:6)
    at Sys.UI.DomEvent.removeHandler (Telerik.Web.UI.WebResource.axd:6)
    at Telerik.Web.UI.Editor.FontNameDropDown.detachEventHandlers (Telerik.Web.UI.WebResource.axd:5055)
    at Telerik.Web.UI.Editor.FontNameDropDown.dispose (Telerik.Web.UI.WebResource.axd:4988)
    at Function.Type.callBaseMethod (Telerik.Web.UI.WebResource.axd:6)
    at Telerik.Web.UI.Editor.FontNameDropDown.dispose (Telerik.Web.UI.WebResource.axd:5206)
    at Sys._Application.disposeElement (Telerik.Web.UI.WebResource.axd:6)
    at Sys.WebForms.PageRequestManager._updatePanel (Telerik.Web.UI.WebResource.axd:15)
    at Sys.WebForms.PageRequestManager._scriptIncludesLoadComplete (Telerik.Web.UI.WebResource.axd:15)
    at Sys.WebForms.PageRequestManager.<anonymous> (Telerik.Web.UI.WebResource.axd:6)

 

Thanks,

Sailaja.

Tags
Editor
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Okey
Top achievements
Rank 1
Max
Top achievements
Rank 1
Danail Vasilev
Telerik team
Brian Garson
Top achievements
Rank 2
Sailaja
Top achievements
Rank 1
Share this question
or