tags:

views:

25

answers:

2

Hi,

I've been searching about using ajax modal popups in asp.net mvc, and i've only seen uses where there's a simple dialog box for input.

Is it possible to open an entire view in an ajax popup? Is it possible to navigate multiple views in a single modal popup instance, as if they were going through a wizard?

I haven't found any good references about this, I would appreciate any and all links to relevant info! thank you !!

A: 

using jQuery UI's dialog plugin, you could do something like:

$("#id").load(url).dialog(); 

and 'url' would be an action on your controller that returns a partial view. then you could put links in your partials that trigger a .load() with the url of the next partial in the wizard.

jqModal also has an AJAX loading feature:

http://dev.iceburg.net/jquery/jqModal/#examples

dave thieben
A: 

You can load any response type your heart desires via ajax and in a modal popup. Most of the good major modal plugins (jquery ui, colorbox, jquery toolbox, etc) have some simple events you can plug into. If the modal plugin doesn't natively support it you can do a simple call to JQuery's "load" method.

$("#modal-dialog").load("/ajax/url");

Create a simple route for "ajax/url" and you're set. You're probably better off returning a partial view for that "ajax/url" action but you can also return plain text, or whole page if you want.

Moral of the story is to set up an action that returns what you need (text, html, xml, etc). Make sure it can be accessed with a route, and use jQuery's ajax methods to fetch it.

DM