How to close the current tab in the server side button click?

北战南征 提交于 2020-01-23 11:19:07

问题


I try to close my current tab after confirm so i put the following code at the end of my confirm button , but the tab doesn't close !


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

回答1:


If you want to close the current window, you could try this:

string jScript = "<script>window.close();</script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "keyClientBlock", jScript);



回答2:


This might help

Response.Write("<script>parent.close_window();</script>");



回答3:


I Just Add Following code on button.

OnClientClick="javascript:window.close();"


来源:https://stackoverflow.com/questions/20197918/how-to-close-the-current-tab-in-the-server-side-button-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!