ClientScript.RegisterStartupScript not working

前端 未结 2 500
不知归路
不知归路 2021-01-18 06:50

I have searched SO & google, but I can\'t seem to get this to work. The code is in the codebehind click event of a \"Cancel\" button in my asp.net application but does

2条回答
  •  不知归路
    2021-01-18 07:15

    You can use this instead

    ScriptManager.RegisterStartupScript(this.Page, GetType(), "ClosePopup", "window.close();", true);
    

    or you can also try this one

    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClosePopup", "window.close();", true);
    

    Have a Good day.

提交回复
热议问题