Reputation: 374
I need to process something on the server from DetailsController from my DetailsView and then I need to return to the DetailsView, but I need display a new windows with the proceced info in new view (DetailsPrint) too, so, any idea how I can make this?
Note: is mandatory go to server, so
@Html.ActionLink("linkText", "Action", new {controller="ControllerName"}, new {target="_blank"})
or
<button onclick="location.href='@Url.Action("Edit", "Home",new { Model.ID })';return false;">Detail</button>
<input type="button" title="Delete" value="D" onclick="location.href='@Url.Action("Edit", "Home", new { id = item.ID })'" />
dont work for me
Upvotes: 1
Views: 3714
Reputation: 1
If you are calling the controller action method from a simple submit Form link as
<input type="submit" value="Print"/>
then you can add a style with the style property formtarget="_blank as follows :
<input type="submit" value="Print" style=" formtarget="_blank"/>
This will show the view result from the controller in New tab .
Upvotes: 0
Reputation: 729
Action link must, as you correctly coded, have target = _blank to open a new window.
At the same time, a parameter must be supplied to DetailsController to let him know he must return DetailsPrint view instead of the normal DetailsView.
You can supply this parameter by query string
@Html.ActionLink("linkText", "Action?print=true", new {controller="ControllerName"}, new {target="_blank"})
Upvotes: 2