Problem with close radwindow

2 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    181 posts
    Member since:
    Jan 2010

    Posted 22 Nov 2012 Link to this post

    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:

    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() {

    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)
    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?

  2. Rumen
    Rumen avatar
    14361 posts

    Posted 26 Nov 2012 Link to this post


    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,
    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.
Back to Top