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

Close Window

2 Answers 60 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Omlac
Top achievements
Rank 1
Omlac asked on 12 Sep 2008, 08:59 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 15 Sep 2008, 07:47 AM
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.
0
Omlac
Top achievements
Rank 1
answered on 15 Sep 2008, 11:00 AM
Thak you very much it worked.
Tags
ToolBar
Asked by
Omlac
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Omlac
Top achievements
Rank 1
Share this question
or