Hi,
I'm new to asp.net and trying to close current tab after button click without asking for any confirmation.
Can anyone pls help me out and below is the code I'm using.
- protected void btn_Click(object sender, ImageClickEventArgs e)
- {
- string strURL = string.Empty;
- strURL = "Nav.aspx?ID=" + strID;
- strURL = "window.open('" + strURL + "');";
- ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", strURL, true);
- ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "text", "Close()", true);
- }
I tried below piece of code and it asks for confirmation. How can I close the window without confirmation prompt message?
- <script type="text/JavaScript" lang="JavaScript">
- function Close()
- {
- window.close();
- }
- </script>
A confirmation box shows up and it shouldn't come and the current window should be closed automatically upon button click.