Hi,
I've been struggling with the following problem for a couple of hours now;
basically I am creating windows dynamically using radopen, when the user wants to close one of these windows I want to show a confirmation asking them if they are sure if they want to close the window or not (if they click ok the window closes, if they click cancel the window stays).
I've put together the following scripts to try to achive this:
//this code taken from http://www.telerik.com/community/forums/aspnet-ajax/window/cancelling-close-request.aspx
Telerik.Web.UI.RadWindow.prototype.oldClose = Telerik.Web.UI.RadWindow.prototype.close; //keep reference to old close method
Telerik.Web.UI.RadWindow.prototype.close = function(callBackFnArg) { //override the close window's close method
ClosingWindow = callBackFnArg;
if (radconfirm('Are you sure?', windowClosed, 330, 100)) //rad confirm is non blocking so the if doesn't get a chance to fire
{
var manager = GetRadWindowManager();
this.oldClose(callBackFnArg); //this works fine
this.oldClose(manager.getActiveWindow()); //this also works ok
}
};
//call back function for the radconfirm
function windowClosed(arg)
{
if (arg)
{
var manager = GetRadWindowManager();
this.oldClose(manager.getActiveWindow()); //object doesn't support this method error
Telerik.Web.UI.RadWindow.prototype.oldClose(manager.getActiveWindow()); //doesn't do anything
manager.closeActiveWindow(); //can't use this as we have overriden the standard close functionality
document.getElementById('<%=btnClose.ClientID%>').click();
}
else
{
//do nothing
}
}
As you can see from above the only way I can get the window to close is if I call this.Close from within the overriden window close function, if I try to close the window from within the windowClosed function I either get an error (depending on which of the lines I execute) or nothing happens, I can't use the overriden window close function because the if will never fire (because the radconfirm prompt is non blocking).
If I replace the radconfirm with a regular javascript alert everything is fine but I'd like to use the radconfirm.
Any ideas?
Thanks.