Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC modal dialog/popup best practice

I am looking for the most standard way to achieve modal dialogs in ASP.NET MVC.

An example of what I am trying to do is when I select an item from my "list" page, I want the "details" page to be a popup over the list and NOT a new page. I'm not looking for a hack. I want it to be a solution that follows the ASP.NET MVC pattern. I would also prefer not stepping outside jQuery and ASP.NET Ajax (no plugins UNLESS it is emerging as a best practice).

like image 723
Brian David Berman Avatar asked May 14 '09 01:05

Brian David Berman


2 Answers

The jQuery UI library has a dialog widget that I use for things like this. While it's a plugin, IMO, the best practice is simply not rolling your own dialog widget.

http://jqueryui.com/demos/dialog/

like image 197
Casey Williams Avatar answered Oct 06 '22 00:10

Casey Williams


Lunchy's dialog suggestion is nice. Just make an ajax request to your controller action and have the action return what you want to display, like a partial view with some formatting html. Then, put that html into your dialog, or whatever you plan to display, and show it.

like image 33
scottm Avatar answered Oct 06 '22 00:10

scottm