how can i open an asp.net MVC view page in new tab. I have a left panel from where you will redirect to new page and i need to open that page in new tab of existing project not in new window.And also from ExtJS Sencha grid cell click.
2 Answers
Isn't it the anchor attribute target http://www.w3schools.com/tags/tag_a.asp what you are looking for? If yes then look here Opening a link in a new tab for the details how to use it.
You can't to this in a standard way.
Opening pages in new tab or new window, is a browser configurable option, not a programmable manner. So, you haven't any control over it.
However, opening new pages(whether in new tabs or new pages) is achieved in client side by this javascript line:
window.open();
Now, you have two ways in front:
1) You just want to open a new tab/page and request a view. Just set the url in the open()
method:
window.open('@Url.Action(...)');
2) You send some data to controller and want to show the results in new tab/page.
First, send an ajax or ordinary post request to the controller and retrieve results in the same view.
Then, open a new tab/page and put that result to it:
var w = window.open();
$(w.document.body).html(content.responseText);

- 18,549
- 7
- 50
- 70
-
I have tried this approach but in view page document.ready() function is not working where i have lot of functions.so is there any another approach without ajax post. – user2682162 Aug 20 '13 at 17:01
-
@user2682162 - Indeed there is, but I don't remember any... However, the idea is what I told you, and you can try to add your own details to that approach... – Amin Saqi Aug 21 '13 at 06:33