RadWindow - GetRadWindow throws javascript error - OffsetWidth

4 posts, 0 answers
  1. Ashlee
    Ashlee avatar
    2 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    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




  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 29 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashlee
    Ashlee avatar
    2 posts
    Member since:
    May 2013

    Posted 30 May 2013 Link to this post

    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.

  5. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 04 Jun 2013 Link to this post

    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.
Back to Top