Click here to Skip to main content
15,663,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)

How to close current page on submit and redirect to other page in new tab ?

Sergey Alexandrovich Kryukov 7-Jul-14 0:44am    
Why closing and showing a different tab? Isn't it equivalent to showing new page in the same window? In this case, the problem becomes trivial.
tahirgr8_2000 7-Jul-14 0:48am    
Dear sergey,
I want that when i click sumbit button, the current page1.aspx will close and it will redirect to another new page2.aspx.

1 solution

Please see my comment the question. This is what I would strongly recommend you to do.

As to the "tab", it looks like the browser "decides" weather a new window should be a separate window or a tab page by its own rule, based on the parameters of The W3 standards don't specify this detail, so you cannot have universal browser-independent control over this feature. Generally, it is recommended to leave it to the user, who can ultimately decide what content should be loaded on a new window, a tab, or in the same window. To most users, adding new windows or tabs without their consent is quite irritating. The users should decide; and your Web application should not rely on any assumptions on what happens on the activation of the link.

Share this answer
tahirgr8_2000 7-Jul-14 0:57am    
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);

Check this . I have used this code for first close my current window and then try to go to new page . But Window not close , only page open with in same tab.

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