Open a view in a new tab from the Controller in ASP MVC

0

People, I have a problem, I need to go from the Details view to the DetailsController server, process something and then return to the Details view, but I need to show the content that I processed in a new DetailsPrint window, any ideas on how to do it?

It is mandatory for me to go to the server, so these methods do not work for me

@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
    
asked by sGermosen 08.07.2017 в 21:11
source

1 answer

1

To open a new tab, use window.open() :

window.open("https://www.google.com");

So this:

<button onclick="location.href='@Url.Action("Edit", "Home",new { Model.ID })';return false;">Detail</button>

Serious:

<button onclick="window.open('@Url.Action("Edit", "Home",new { Model.ID })')">
Detail
</button>

Just keep in mind that there are browsers that bring this option disabled by default so you have to activate them in the configuration of the same.

    
answered by 09.07.2017 в 04:15