如何从窗口模式对话框导航到父页面? [英] How to navigate from window modal dialog box to parent page?

查看:76
本文介绍了如何从窗口模式对话框导航到父页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

请帮助我为以下secenario编写C#代码,

我已经创建了aspx页并在其中使用了母版页.从该页上单击查看",我导航到模态对话框"页.

我在对话框页面中有后退按钮.单击时,我想关闭此页面,所以我尝试了window.close().它打开了另一个页面,问是否要关闭.

请指导我如何关闭模式对话框页面?

预先感谢.

解决方案

首先,如果对话框是真正的模态对话框,则它不应具有后退"按钮.模态行为意味着您只能使用一个对话框,而不能使用其他窗口,请完成工作并关闭它.当您关闭它时,无论如何您将在同一页面上.因此,该对话框可以带有关闭"按钮或确定"(我不喜欢,因为–可以吗?),以及取消"之类的其他内容.

严格来说,Web应用程序不可能实现强模式行为,因为您始终可以使用相同的URI创建任意数量的Web浏览器窗口,并切换到打开了模式对话框的窗口,因此您的应用程序应处理此类情况.您的应用程序应建议用户仅使用一个窗口并在需要时使用模态行为,但要准备处理用户做其他事情时的情况.

我建议将 jQuery 用于模式对话框或模式窗口.周围有很多组件.要获得一个不错的主意,请查看以下三个:
http://jqueryui.com/demos/dialog/ [ http://jquery.com/demo/thickbox/ [ http://www.queness.com/resources/html/modal/jquery-modal- window.html [^ ].

另请参见:
http://en.wikipedia.org/wiki/JQuery [ http://docs.jquery.com/Main_Page [ http://bit.ly/z5A3TB :-) [ 解决方案

First, if the dialog box is truly modal, it should not have a "back" button. The modal behavior means that you should work only with one dialog, not other windows, complete the work, and close it; when you close it, you will be on the same page anyway. So, the dialog box can have a "Close" button or "OK" (which I don''t like, because — what is OK?), along with others like "Cancel".

Strictly speaking, strongly modal behavior is not possible with Web applications because you can always create any number of Web browser''s windows with the same URI and switch to them having a modal dialog box open, so your application should handle such cases. Your application should suggest the user to work with only one window and use modal behavior where required but be prepare to handle the situations when the user does something different.

I would recommend to use
jQuery for modal dialog or a modal window. There is a big number of components around. To get a pretty good idea, look at these three:
http://jqueryui.com/demos/dialog/[^],
http://jquery.com/demo/thickbox/[^],
http://www.queness.com/resources/html/modal/jquery-modal-window.html[^].

See also:
http://en.wikipedia.org/wiki/JQuery[^],
http://docs.jquery.com/Main_Page[^].

You can choose from more than a million search results: http://bit.ly/z5A3TB :-)[^].

—SA


I placed the base target to self in parent page and window.close() script in dialog page.This works to my requirement.


这篇关于如何从窗口模式对话框导航到父页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆