SimpleModal打破ASP.Net回发 [英] SimpleModal breaks ASP.Net Postbacks

查看:214
本文介绍了SimpleModal打破ASP.Net回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 jQuery的 SimpleModal 在一个ASP.Net项目,使一些很好的对话为一个web应用程序。不幸的是,在一个模式对话框任何按钮无法再执行自己的回发,这是不是真的可以接受的。

I'm using jQuery and SimpleModal in an ASP.Net project to make some nice dialogs for a web app. Unfortunately, any buttons in a modal dialog can no longer execute their postbacks, which is not really acceptable.

有一个源我用<一发现href=\"http://blog.hurlman.com/post/jQuery2c-simpleModal2c-and-ASPNet-postbacks-do-not-play-well-together.aspx\">workaround,但对我的生活,我不能得到它的工作,主要是因为我不完全理解所有必要的步骤。

There is one source I've found with a workaround, but for the life of me I can't get it to work, mostly because I am not fully understanding all of the necessary steps.

我也有一个解决办法,这是取代回发,但它的丑陋,也许并不是最可靠的。我真的想使回传重新工作。任何想法?

I also have a workaround, which is to replace the postbacks, but it's ugly and probably not the most reliable. I would really like to make the postbacks work again. Any ideas?

更新:我要澄清,在回发不工作,因为JavaScript的用于执行后背上以某种方式打破,所以什么也没发生的按钮被点击时,在所有

UPDATE: I should clarify, the postbacks are not working because the Javascript used to execute the post backs has broken in some way, so nothing happens at all when the button is clicked.

推荐答案

双方你在正确的轨道上。我意识到的是,SimpleModal追加对话框的身体,这是外ASP.Net的&LT;形式&GT; ,打破了功能,因为它无法找到的元素

Both of you were on the right track. What I realized is that SimpleModal appends the dialog to the body, which is outside ASP.Net's <form>, which breaks the functionality, since it can't find the elements.

要修复它,我只是修改了SimpleModal源追加eveything到'形式'而不是身体。当我创建对话框,我也用坚持:真选项,以确保按钮保持通过打开和关闭

To fix it, I just modified the SimpleModal source to append eveything to 'form' instead of 'body'. When I create the dialog, I also use the persist: true option, to make sure the buttons stay through opening and closing.

谢谢大家的建议!

更新:的1.3版本增加了在指定配置哪个元素的模态对话框应该被追加到一个 appendTo 选项。 下面是文档

UPDATE: Version 1.3 adds an appendTo option in the configuration for specifying which element the modal dialog should be appended to. Here are the docs.

这篇关于SimpleModal打破ASP.Net回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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