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

unspecified error - while trying to close radwindow on button click

3 Answers 148 Views
Window
This is a migrated thread and some comments may be shown as answers.
L U C K Y
Top achievements
Rank 1
L U C K Y asked on 09 Jan 2009, 04:31 AM

Hi,

 

I have been working with the telerik r.a.d. window ASP.NET control recently. I am facing a javascript error when I try to close the radwindow. Please read the paragraph below to get a clear picture of the requirement and design.

 

I have a my default.aspx page which is the landing page and has a dhtml menu , upon selection of a menu item I open a radwindow (lets call it rw1). On click of a image on the rw1 window I have to open another radwindow (lest call it rw2) and there is a haze/gray screen in the backround so that the user cannot work on the default.aspx page or the rw1 window. From rw2 I have to open a third radwindow (lets call it rw3). Both the windows ( i.e., rw2 and rw3) have 2 buttons “apply” and “cancel”. From rw3 when the user clicks on apply the values are passed to the rw2 window and a listbox and a few labels are refreshed.

 

Note – I am not using OnClientClose handler to refresh the controls on rw2. I am doing it by accessing the controls via the radwindow manager which is on the dafault.aspx page.

 

var oManager = parent.GetRadWindowManager() ;

//window name here is the rw2 window name which is being passed in the query string when the rw3 window is opened.

var oWnd = oManager.GetWindowByName( windowName ) ;

 

//gets the outer div of the listbox, from which I can get the items

var oList = oWnd.GetContentFrame().contentWindow.$find('listname'); 

 

Now after the controls in rw2 are refreshed I have to close the rw3 window , the code that I use is below.

 

getRadWindow().Close();

 

function getRadWindow()

{

   var oWindow = null;

   if (window.radWindow) oWindow = window.radWindow;

   else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)

   return oWindow;

}

 

This works absolutely fine for me the controls get refreshed and the window closes. The problem is the cancel button implementation. On the cancel click I just have to close the radwindow (rw3 or rw2 as both have cancel buttons).

 

I tried by using

 

getRadWindow().Close();

 

This throws a script error in the following piece of code at location colored red:

 

case Sys.Browser.InternetExplorer:

        Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {

            /// <param name="element" domElement="true"></param>

            /// <returns type="Sys.UI.Point"></returns>

            var e = Function._validateParams(arguments, [

                {name: "element", domElement: true}

            ]);

            if (e) throw e;

 

                        if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);

 

                                                var clientRects = element.getClientRects();

            if (!clientRects || !clientRects.length) {

                return new Sys.UI.Point(0,0);

            }

 

            var w = element.ownerDocument.parentWindow;

            var offsetL = w.screenLeft - top.screenLeft - top.document.documentElement.scrollLeft + 2;

            var offsetT = w.screenTop - top.screenTop - top.document.documentElement.scrollTop + 2;

 

                                                                        var f = w.frameElement || null;

            if (f) {

                                                                                var fstyle = f.currentStyle;

                offsetL += (f.frameBorder || 1) * 2 +

                    (parseInt(fstyle.paddingLeft) || 0) +

                    (parseInt(fstyle.borderLeftWidth) || 0) -

                    element.ownerDocument.documentElement.scrollLeft;

                offsetT += (f.frameBorder || 1) * 2 +

                    (parseInt(fstyle.paddingTop) || 0) +

                    (parseInt(fstyle.borderTopWidth) || 0) -

                    element.ownerDocument.documentElement.scrollTop;

            }

 

            var clientRect = clientRects[0];

 

            return new Sys.UI.Point(

                clientRect.left - offsetL,

                clientRect.top - offsetT);

        }

        break;

 

The above snippet is from the ScriptResource.axd file (is it a telerik specific file?). The lines that throw the error are marked in red. The error message is “unspecified error”. I suppose this is not a microsoft specific file as it has many switch cases for different browsers.

 

This error comes only on IE. I tested with firefox and it works fine there. This is a showstopper in IE for me. Please help.

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 10 Jan 2009, 01:14 PM
Hi,

The code that you posted looks fine and should not be the reason for the problem. To be able to help however we need to reproduce the problem locally so we can investigate further. Please open a support ticket and send us a small sample project where this issue can be observed. We will check it right away and get back to you with solutuon.



Regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Stephen
Top achievements
Rank 1
answered on 04 Feb 2009, 03:01 PM
I've found that in the client script where the window is being opened and the method set_destroyOnClose(true) is used, it causes this error.  I'm now using set_reloadOnShow(true), this resolves the AJAX error, and the window closes error-free.  This may or may not be your issue, but it's just a thought.
0
Georgi Tunev
Telerik team
answered on 05 Feb 2009, 09:51 AM
Hi Stephen,

In such case, please send me a small sample project in a support ticket that reproduces your setup and the problem itself (if you have time of course). I will examine it and get back to you with solution.


Kind regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
L U C K Y
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Stephen
Top achievements
Rank 1
Share this question
or