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

Url Change Parent window on RadWindow Close

5 Answers 282 Views
Window
This is a migrated thread and some comments may be shown as answers.
Myo
Top achievements
Rank 1
Myo asked on 29 Nov 2013, 01:00 AM
Please Anybody can help me? 
I cann't change parent window url after radwindow close.
this is code on parent window .
 function UpdateParentPage(args) {

                if (args != null && args != '') {
                    if (args.startsWith('MoveReservation')) {
                        UpdateParentPageWithAjaxRequest('GrpResRoomRebind');
                    }
                    else if (args.startsWith('CheckIn')) {
                        window.location.reload();
                    }
                    else {
                        UpdateParentPageWithAjaxRequest('ReBindTransList');
                       // RedirePage();
                    }
                }
            }
            function RedirePage()
            {
               top.location.href= "../../Reservation/FolioNew.aspx";
            }
.....
Code on RadWindow
   function ResizeAndClose(width, height, key) {
                    //if (document.referrer.indexOf("/Update/ReservationDetails.aspx") > 0) {

                    //    top.location.href = '../../Reservation/FolioNew.aspx?';

                    //}
                    GetRadWindow().setSize(width, height);
                   
                    setTimeout('GetRadWindow().close("")', 100);
                   
                    GetRadWindow().BrowserWindow.UpdateParentPage(key);
                    GetRadWindow().BrowserWindow.RedirePage();

                   
                }

What i want is after process this  GetRadWindow().BrowserWindow.UpdateParentPage(key), want to go redirepage. 

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 29 Nov 2013, 11:17 AM
Hello Myo,

I am attaching here a simple example that shows how redirects can work, and I have added some comments to aid you. Note that how you devise these functions depends on your code, requirements and preferences, not on our controls.


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 the blog feed now.
0
Myo
Top achievements
Rank 1
answered on 01 Dec 2013, 11:20 AM
Hello Marin,

I have tried to call my redirect page function from parent window (once after processing done) or call from child window itself. But both methods are failed to redirect to another page. 

When I trace, top.location.href does not change even though I passed the full parameter path. 

Could you please  enlighten me, which part is wrong? 

Code in parent page:-
function UpdateParentPageWithAjaxRequest(command) {
                var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                ajaxManager.ajaxRequest(command);
                alert(command);
                if (command.startsWith('ReBindTransList')) {
                    alert("2");
                    RedirePage();
                }
               
            }
function RedirePage()
            {                
                top.location.href = '/Reservation/FolioNew.aspx';               
            }


Basically what I need is:- 
1) parent page called child page (content page)
2) change some information & close it
3) update function fired in parent page 
4) navigate to new page (Reservation/FolioNew.aspx which is located under same project but different folder)

At point 4, I tried to use "top.location.href = <url>" or "window.location.href = <url>". However, both methods do not navigate as expected. 

As I'm very new in Telerik controls, appreciate any sample project with three simple pages & redirect functionality. Thanks in advance. 

0
Shinu
Top achievements
Rank 2
answered on 02 Dec 2013, 06:08 AM
Hi Myo,

Please try the following JavaScript to achieve your scenario.

JavaScript:
function RedirePage() {
    document.location.href = '../Reservation/FolioNew.aspx';
}

Thanks,
Shinu.

0
Myo
Top achievements
Rank 1
answered on 02 Dec 2013, 07:29 AM
Hi Shinu,

It is working on Chrome and FireFox but not working on IE. Please give me some advices.

Thanks
0
Shinu
Top achievements
Rank 2
answered on 03 Dec 2013, 03:25 AM
Hi Myo,

Unfortunately I couldn't replicate the issue at my end. The given code is working fine at my end. As a suggestion please try the JQuery code to redirect to another page.

JavaScript:
<script src="../JS/jquery-1.10.1.min.js"></script>
<script tye="text/javascript">
    function RedirePage() {
        var url = '../Reservation/FolioNew.aspx';
        $(location).attr('href', url);
    }
</script>

Hope this will helps you.
Thanks,
Shinu.
Tags
Window
Asked by
Myo
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Myo
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or