Reputation: 193
So I have a scenario where I want to return my ActionResult...Return View("ViewName", "MasterPageName",model); in a popup window of a specific size I can pass...
E.G.:
public ActionResult PopUp()
{
//do some work...
//I want this returned in a popup window/modal dialog of some sort...
return View("ViewName","MasterPageName",model);
}
what is a reasonable way to accomplish this from the controller in asp.net mvc?
thanks in advance.
Upvotes: 3
Views: 12043
Reputation: 32
Maybe you can try dynamically loading the rendered view using jQuery.load()
Upvotes: -1
Reputation: 7449
Nothing can be done on server side but you can decorate your action links like
<%= Html.ActionLink("Pop Up", "PopUp", null, new {target="_blank"}) %>
Upvotes: 2
Reputation: 16974
This is not something you can really do from your controller as this is code that executes on the server as the result of a http request and returns a response of some form or other. You will need to do this on the client, probably using javascript or alternatively you can call your controller action and specify the target attribute of the a tag as '_blank'.
Upvotes: 0
Reputation: 20617
You can't manipulate the client side browser from a Controller on the server-side. What you can do is output script in your returned view, or call a controller that returns data via an AJAX call and pop-up from the client-side.
Upvotes: 0