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.