开发者

asp.net mvc: display a lightbox from a controller's action result

I have an action that returns ViewResult (it's a detail form, public ViewResult AddFoo(long id) and I need to display this res开发者_StackOverflow中文版ult 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


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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜