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

RadWindow - GetRadWindow throws javascript error - OffsetWidth

3 Answers 91 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ashlee
Top achievements
Rank 1
Ashlee asked on 28 May 2013, 11:41 AM
Hello,

I am currently getting a strange error. Throughout our application we are using the GetRadwindow Function to find the currently opened RadWindow, then closing it after a button submit.

function GetRadWindow() {
           var oWindow = null;
 
           if (window.radWindow) {
               oWindow = window.radWindow;
           }
           else if (window.frameElement.radWindow) {
               oWindow = window.frameElement.radWindow;
           }
 
           return oWindow;
       }
 
       function returnToParent(ID) {
           //create the argument that will be returned to the parent page
           var oArg = new Object();
           oArg.ID = ID;
 
           //get a reference to the current RadWindow
           var oWnd = GetRadWindow();
 
           oWnd.Close();
       }

When It calls this function I am getting the following error:

Unable to get value of the property 'offsetWidth': object is null

I am stumped to what could be causing this, because we weren't getting this error before. We recently updated our telerik controls, so maybe this as something to do with it? Any help would be appreciated.

Thanks,

Ashlee




3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 29 May 2013, 02:01 PM
Hello Ashlee,

I have not seen such an error before and there have not been major changes to the control recently. What I can suggest at this point is that you try adding a small timeout before close:

function returnToParent(ID) {
    //create the argument that will be returned to the parent page
    var oArg = new Object();
    oArg.ID = ID;
 
    //get a reference to the current RadWindow
    var oWnd = GetRadWindow();
    setTimeout(function () {
        oWnd.close();
    }, 0);
}

Additionally, ou can also see if you have the DestroyOnClose property set to true for this popup and reset it to false if possible for your scenario.

If neither of this helps could you post here the simplest code that reproduces the error on your end along with the exact version of our controls that you are using, plus the browser that is experiencing the problem?

Regards,
Marin Bratanov
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 their blog feed now.
0
Ashlee
Top achievements
Rank 1
answered on 30 May 2013, 02:54 PM

One thing I noticed about this issue is that it only happens when I have a radcombobox on the radwindow.  If I remove the combobox or change it to a raddropdownlist it works just fine.   The javascript it breaks on is:



The weird thing is it sometimes happens when I open the radwindow that has the radcombobox and on other windows it breaks when I close the radwindow with the radcombobox.

0
Dobromir
Telerik team
answered on 04 Jun 2013, 10:29 AM
Hello Ashlee,

Thank you for the provided additional information, however, I was unable to reproduce the problem locally. Could you please provide more detailed information on the subject?
  • Which version of RadControls for ASP.NET AJAX and .NET Framework are used in the application?
  • Under which browser and its version the problem occurs?
  • Are you able to reproduce the problem on the live demos? If so, could you please provide the exact steps the need to be executed in order to reproduce the issue?
  • Could you please provide a simple fully runnable project reproducing the problem so we can investigate it further?

For your convenience I have attached my test page. Could you please modify it to the point where the problem occurs and send it back so we can examine and debug it locally?


Regards,
Dobromir
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 their blog feed now.
Tags
Window
Asked by
Ashlee
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Ashlee
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or