问题描述
我正在寻找在 ASP.NET MVC 中实现模式对话框的最标准方法.
I am looking for the most standard way to achieve modal dialogs in ASP.NET MVC.
我正在尝试做的一个示例是,当我从列表"页面中选择一个项目时,我希望详细信息"页面成为列表上的弹出窗口,而不是新页面.我不是在寻找黑客.我希望它是一个遵循 ASP.NET MVC 模式的解决方案.我也更喜欢不要跳出 jQuery 和 ASP.NET Ajax(没有插件,除非它正在成为一种最佳实践).
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).
推荐答案
Lunchy 的对话建议不错.只需向您的控制器操作发出 ajax 请求并让该操作返回您想要显示的内容,例如带有一些格式化 html 的局部视图.然后,将该 html 放入您的对话框中,或者您打算显示的任何内容中,然后显示它.
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.
这篇关于ASP.NET MVC 模式对话框/弹出窗口最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论