最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How to close a tab from code behind? - Stack Overflow

programmeradmin2浏览0评论

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>");
发布评论

评论列表(0)

  1. 暂无评论