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

Strange javascript error on close

4 Answers 115 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sébastien
Top achievements
Rank 1
Sébastien asked on 25 Jun 2010, 06:48 PM
My application looks like this :

There is a radSplitter with two panes, and the bottom pane contains a radEditor and is collasped at startup. I have a radAjaxManager that update the radEditor, and this javascript function :
function scriptError() { 
            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
            ajaxManager.ajaxRequest("x"); 
        } 

Now the ajax request looks like this :
If e.Argument.Equals("x"Then 
    RadEditor1.Content = "<br /><p>Some Text...</p>" 
End If 

It's working fine as a web application in internet explorer, but I'm rendering this page in a webbrowser control of a winForm application and I'm calling the script on a button click :
WebBrowser1.Document.InvokeScript("scriptError"New Object() {}) 

Up to this, no error. It is when I close the application that a strange javascript error appear ("_events is null or not an object ......"). The error only appear when the bottom pane is collasped???

I'm quite new to web programming so it is possible that there is a logic error in my programming, but have totally no idea why it is causing this.

Thanks

4 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 01 Jul 2010, 10:57 AM
Hi Sébastien,

We are not aware of this problem and you are the first one to report it. I tried to reproduce the error on mi side with the provided information but to no avail. Could you please describe your exact scenario in more details?

For your convenience I have attached my test project. Could you please modify it to a point where the problem occurs and send it back so we can investigate it further?

Regards,
Dobromir
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
Sébastien
Top achievements
Rank 1
answered on 02 Jul 2010, 01:57 PM
Don't have acces to visual studio right now, but here is the  code of my files

ASPX page :
<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ErrorRadEditor._Default" %> 
 
<!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
    <style type="text/css"
        html, body, form 
        { 
            height: 100%; 
            margin: 0px; 
            padding: 0px; 
            overflow: hidden; 
        } 
    </style> 
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" /> 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager> 
    <script type="text/javascript"
        function scriptError() { 
            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
            ajaxManager.ajaxRequest("x"); 
        } 
    </script> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
         
    </telerik:RadAjaxManager> 
  
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Default"
    </telerik:RadSkinManager> 
    <div style="height:100%"
         
        <telerik:RadSplitter ID="RadSplitter1" Runat="server" Orientation="Horizontal" Height="100%" Width="100%"
            <telerik:RadPane ID="RadPane1" runat="server"
                <asp:Button ID="Button1" Text="ClickMe!" OnClientClick="scriptError();return false;" runat="server"/> 
            </telerik:RadPane> 
            <telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Both"
            </telerik:RadSplitBar> 
         
            <telerik:RadPane ID="RadPane2" runat="server" Collapsed="true"
                <telerik:RadEditor ID="RadEditor1" runat="server"
                </telerik:RadEditor> 
             
            </telerik:RadPane> 
         
        </telerik:RadSplitter> 
         
    </div> 
    </form> 
</body> 
</html> 
 

ASPX.VB (nothing here)
Imports Telerik.Web.UI 
 
Partial Class _Default 
    Inherits System.Web.UI.Page 
 
    Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
 
    End Sub 
 
    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As ObjectByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest 
 
    End Sub 
End Class 
 

and Form1.vb :
Public Class Form1 
 
    Private Sub Form1_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
        WebBrowser1.Navigate("http://localhost:49646/Default.aspx"
    End Sub 
 
    Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click 
        WebBrowser1.Document.InvokeScript("scriptError"New Object() {}) 
    End Sub 
End Class 
 

The error occure when I click the button on the page or the button on the Form and then close the application.
0
Accepted
Dobromir
Telerik team
answered on 05 Jul 2010, 04:22 PM
Hi Sébastien,

Thank you for the clarification. I was able to reproduce the problem with the additional information. I can confirm that this is a bug in the RadSplitter's code. I have logged it into our PITS system and we will do our best to fix it for one of the upcoming releases. You can follow the PITS Issue by its ID: 2613.

For the time being you can use one of the following approaches to avoid this error:
  1. Wrap the RadEditor in a <div> with display:none when the pane is collapsed by default and change that value on collapse / expand, e.g.:
        //.......
        <telerik:RadPane ID="RadPane2" runat="server" Collapsed="true" OnClientCollapsed="OnClientCollapsed"
            OnClientExpanded="OnClientExpanded">
            <div id="editorWrapper" style="display:none;">
                <telerik:RadEditor ID="RadEditor1" runat="server">
                </telerik:RadEditor>
            </div>
        </telerik:RadPane>
    </telerik:RadSplitter>
    <script type="text/javascript">
        function OnClientCollapsed(sender, args)
        {
            $get("editorWrapper").style.display = "none";
        }
     
        function OnClientExpanded(sender, args)
        {
            $get("editorWrapper").style.display = "";
        }
    </script>
  2. Another solution is to set PersistScrollPosition property of the pane containing the RadEditor to "false", e.g.:
    <telerik:RadPane ID="RadPane2" runat="server" Collapsed="true" PersistScrollPosition="false">
        <telerik:RadEditor ID="RadEditor1" runat="server">
        </telerik:RadEditor>
    </telerik:RadPane>

As a small token of gratitude I have updated your Telerik points.
Kind regards,
Dobromir
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
Sébastien
Top achievements
Rank 1
answered on 05 Jul 2010, 06:08 PM
Thanks again for your answer.
Tags
Editor
Asked by
Sébastien
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Sébastien
Top achievements
Rank 1
Share this question
or