Programmatically Close Aspx Page from Code Behind

Programmatically close aspx page from code behind

UPDATE: I have taken all of your input and came up with the following solution:

In code behind:

protected void Page_Load(object sender, EventArgs e)    
{
Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");
}

In aspx page:

function CloseWindow() {
window.close();
}

closing the aspx page by writing code?

Use javascript to call document.window.close() on the click event. You would need to post code or more details about your platform to provide any more.

Unable to close current window

Try the following link

Programmatically close aspx page from code behind

Based on the scenario it may very. Please read the above thread replies

Also the following link shows the same question

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



Related Topics



Leave a reply



Submit