JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
JOSE MANUEL PÉREZ RAMÍREZ
asked on 03 Feb 2009, 12:53 PM
I have one webform (A) and opens (B).
when user close (B) with close window button (X behavior close) method. i want to execute a method from B window.
Is posible
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 03 Feb 2009, 02:33 PM
Hi Jose Manuel,
You can attach the method to onbeforeunload with window-B for executing it before closing the RadWindow. Also make sure that you set the property DestroyOnClose="true" of the RadWindowManager.
ASPX:
<body onbeforeunload="HandleOnClose()"> |
JavaScript:
<script type="text/javascript"> |
function HandleOnClose() |
{ |
// Add your code |
} |
</script> |
Thanks,
Princy.
0
Ole
Top achievements
Rank 2
answered on 04 Feb 2009, 10:07 AM
sadly onbeforeunload does not work on firefox :(
0
Hello Jose,
You can use OnClientClose event of the RadWindow control and attach to it a function, which is on the 'WebForm A' as showed bellow :
RadWindow declaration on the 'WebFormA' :
OnClose function on the 'WebFormA' :
More details for the RadWindow methods can be found in this help page.
I hope this helps.
Sincerely yours,
Fiko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use OnClientClose event of the RadWindow control and attach to it a function, which is on the 'WebForm A' as showed bellow :
RadWindow declaration on the 'WebFormA' :
<telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true" NavigateUrl="WebFormB.aspx" |
OnClientClose="OnClose"> |
OnClose function on the 'WebFormA' :
<script type="text/javascript"> |
function OnClose(sender, args) |
{ |
// Call your functions |
alert(" FORM 'A' "); |
} |
</script> |
More details for the RadWindow methods can be found in this help page.
I hope this helps.
Sincerely yours,
Fiko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Patrick
Top achievements
Rank 1
answered on 13 May 2009, 03:14 PM
Hey,
I have the same problem but the solution over do not solve it.
I want to have a Value from (B) in (A).
In my case I have a Rotator in my Window and want to have the CurrentIndex in (A). I have already a "Close"-Button which works good. But I want the same behaviour on the X-Button of Window (B).
Short: Call a js-function of window (B) when regular closebutton from window is pushed.
I hope you understand my problem.
I already tried this: Overwrite the Close Method but doesn´t work.
Thanks.
Patrick
I have the same problem but the solution over do not solve it.
I want to have a Value from (B) in (A).
In my case I have a Rotator in my Window and want to have the CurrentIndex in (A). I have already a "Close"-Button which works good. But I want the same behaviour on the X-Button of Window (B).
Short: Call a js-function of window (B) when regular closebutton from window is pushed.
I hope you understand my problem.
I already tried this: Overwrite the Close Method but doesn´t work.
Thanks.
Patrick
0
Hi Patrick,
You do not need to override the close() function. Bellow, I describe the steps that are implemented in the attached demo project.
This approach will work in both scenarios : by clicking the X-button or by closing the window programmatically - oWindow.close().
I hope this helps.
Greetings,
Fiko
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You do not need to override the close() function. Bellow, I describe the steps that are implemented in the attached demo project.
- on the content page I have implemented the following simple logic :
- attach handler to the OnClientShown event of the RadRotator control.
- in that event get the reference to the current showed item and get its index in the items' collection :
var currentIndex = args.get_item().get_index();// Get the current index - store that value in a custom property of the RadWindow object :
GetRadWindow().MyCustomProperty = currentIndex; // Store the current index
- you can access the MyCustomProperty in the OnClientClose handler of the RadWindow object on the parent page as follows :
function OnClientClose(oWindow, args) { alert("Current index : " + oWindow.MyCustomProperty); }
This approach will work in both scenarios : by clicking the X-button or by closing the window programmatically - oWindow.close().
I hope this helps.
Greetings,
Fiko
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Patrick
Top achievements
Rank 1
answered on 14 May 2009, 09:06 AM
Hello Fiko,
I understood it, tried it and it works pretty well.
I appreciate your support! Thank you so much. :)
My code is much cleaner now.
Greetings Patrick
I understood it, tried it and it works pretty well.
I appreciate your support! Thank you so much. :)
My code is much cleaner now.
Greetings Patrick