views:

282

answers:

1

I have an action that returns ViewResult (it's a detail form, public ViewResult AddFoo(long id) and I need to display this result in a lightbox

  • My first idea was to generate a div with an iframe, but than I don't know how am I going to close (hide the div) this lightbox on submit
  • Other thing that I could do is take somehow the generated html from the action (from <body> to </body>), and put it inside the div instead of the iframe

How do you do this kind of stuff, I think there should a better way

+3  A: 

Generally, when you want to display a view in the context of another page, you return a PartialViewResult instead of a ViewResult. Then you can write JavaScript like:

$("#someDiv").load("/path/to/action");
Craig Stuntz