ASP.NET MVC 模式对话框/弹出窗口最佳实践

编程入门 行业动态 更新时间:2024-10-28 15:35:21
本文介绍了ASP.NET MVC 模式对话框/弹出窗口最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在 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:关键词]

本文发布于:2023-03-18 22:30:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/620962.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   弹出窗口   模式   ASP   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!