admin管理员组

文章数量:1394409

I want to close current tab from code behind as i want to perform some operation so after performing some operation it should be closed so please help me.. thanks in advance.

I tried it with

function close_window() {
  if (confirm("Close Window?")) {
    close();
  }
}

but not able to call this method from code behind.

I want to close current tab from code behind as i want to perform some operation so after performing some operation it should be closed so please help me.. thanks in advance.

I tried it with

function close_window() {
  if (confirm("Close Window?")) {
    close();
  }
}

but not able to call this method from code behind.

Share Improve this question edited Mar 5, 2012 at 10:19 svick 245k53 gold badges405 silver badges531 bronze badges asked Mar 5, 2012 at 10:16 milind talatimilind talati 131 silver badge3 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 4
    string jScript;
    jScript="<script>close_window();</script>";
    ClientScript.RegisterClientScriptBlock(this.GetType(),"keyClientBlock", jScript); 

I know this is an old thread, but I thought I would post what worked for me. Tested and working in .NET 3.5 & 4.0.

Response.Write("<script>window.close();</script>");

本文标签: cHow to close a tab from code behindStack Overflow