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

Problem with close radwindow

1 Answer 60 Views
Window
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 22 Nov 2012, 09:33 AM
hello,
use a radwindow to create a custom message. I have a problem, when you acknowledge that you have read the message, the radwindow must close and you must open a normal aspx page. To close the radwindow use this code that runs a javascript function:

code vb.net:
Me.ClientScript.RegisterStartupScript(Me.GetType, "", "Close();", True)

code html:

<script type="text/javascript">
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
 
    function Close() {
        GetRadWindow().close();
    }
</script>

now here's the code I would use to close the radwindow and open a normal page aspx:

Protected Sub ImgBtncontinua_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgBtncontinua.Click
    Me.ClientScript.RegisterStartupScript(Me.GetType, "", "Close();", True)
    Session.Add("Profilo", 0)
    Response.Redirect("~/profilo.aspx")
End Sub

but the page is loaded into the profilo.aspx radwindow instead I would like to close the radwindow and open the page profilo.aspx, how do it?

Bye

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Nov 2012, 05:02 PM
Hi,

Since the Response.Redirect("~/profilo.aspx") line changes the response, there is not a way to register the script (Close function) before that. That is why the script will simply not travel to the browser. Moreover, you are in the context of the RadWindow's page, so it is not possible to redirect to the main page. Also, redirecting the main page will effectively close the RadWindow.

You can use window.location.href to redirect to another page using client script. If you do not want to hardcode the url in the script, you can use window.location.href=param where param is the paramter to the function, passed from the code-behind.


Kind regards,
Rumen
the Telerik team
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 their blog feed now.
Tags
Window
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or