Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
Hi Dears...


Could anyone please tell me how to close current asp .net page on button click in my asp .net web site application.

also I would like to know how to close current browser tab on button click.



Thank You... :)
Posted

C#
protected void button_click(object sender, EventArgs e)
{
    Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");
}
 
Share this answer
 
Comments
Member 13343954 26-Oct-17 1:21am    
not working that code. I'll check today
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900