How to open more than one View in a controller?

Asked

Viewed 258 times

-1

I have a controller called Request:

[HttpPost]
public ActionResult Pedido()
{
    return View();
}

How to open more than one View in a Controller? By calling a Controller would like to open two views.

Note: I would like to open and different tabs.

5 answers

2

In the controller, I don’t think I can return two views at once. I don’t know if that’s your case, but you can reroute to different routes, return RedirectToRoute(new { controller = "controlador", action = "ação" });.

0

As far as I know there’s no way you can open two Views.

To Action of your Controller must return a View only.

But in his View you can create flaps.

0

The action returns only one view, what you can do is in this view call an ajax that opens the new view in another tab but... I do not know if it is the best to do.

0

The controller allows directing only to a view. But you can, no load from your view, open a new tab with javascript.

In his view, add this function to a block of script:

function novaaba() {
    window.open("SUA_URL_AQUI", '_blank');
}

And then call her on load of your body, thus:

<body onLoad="novaaba();">

0

Within your order view you will have to call a partial view.

<fieldset>
     <lengend>Itens do pedido</legend>
     @Html.Partial("ItemDoPedido", idPedido)
</fieldset>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.