Close Window

3 posts, 1 answers
  1. Omlac
    Omlac avatar
    64 posts
    Member since:
    Jul 2008

    Posted 12 Sep 2008 Link to this post

    Hie all,
    I have got a small problem, im using the code below to close a page. It works only when its under a button(ie button click event) but when i use a toolbar click event its not closing the page, even though it runs through the code without any errors. does anyone know whats wrong.

    protected void RadToolBar1_ButtonClick1(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
    {
    if ((e.Item.Text == "Save & Close")
    {
    string scriptString = "<script language="JavaScript"> window.close();</script>
    Page.ClientScript.RegisterClientScriptBlock(this.GetType()), "submitScript", scriptString);
    }
    }
  2. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Sep 2008 Link to this post

    Hi Omlac,

    Please try this code:

    if (e.Item.Text == "Save & Close"
            string script = "window.close();"
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", script, true); 

    I hope this helps.

    All the best,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Omlac
    Omlac avatar
    64 posts
    Member since:
    Jul 2008

    Posted 15 Sep 2008 Link to this post

    Thak you very much it worked.
Back to Top