更新面板内的 jqmodal 问题
我有一个控件需要显示为页面或模式对话框。 在 page_load 事件中,我查看是否设置了 modal 属性,如果设置了,我注册一个脚本来调用 jqmodal。 代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (this.Modal) // Show as a modal dialog
{
selector.Attributes.Add("class", "jqmWindow");
selector.Attributes.Add("style", "width:1100px;height:600px;");
string script = "<script type=\"text/javascript\">$().ready(function() { $(" + "'#" + selector.ClientID + "').jqm({ modal: true }).jqmShow();});</script>";
//script = "<script type=\"text/javascript\">confirm('hello');</script>";
ScriptManager.RegisterStartupScript(this,this.GetType(),"duh",script,false);
}
}
该控件用在具有更新面板的页面上。 这一切在 Firefox 和 IE 中都可以很好地用于初始页面加载和任何刷新。 但是,当我回发时,我在 IE 和 FF 中遇到问题: 在 IE 中,表示模式的 div(在本例中为选择器)向下并向右移动约 500 px。
在 Firefox 中,div 周围的黑暗区域随着每次回发而逐渐变暗。
如果我从主页中删除更新面板(它实际上在主页中),则此代码可以工作。
我尝试在回发时不执行上述代码,但这只是禁用了 jqmodal。 我真的很困惑如果有人可以帮助我,我将不胜感激。
I have a control that I need to display as a page or as a modal dialog.
In the page_load event I look to see if the modal property is set and if so, I register a script to invoke jqmodal. Here is the code:
protected void Page_Load(object sender, EventArgs e)
{
if (this.Modal) // Show as a modal dialog
{
selector.Attributes.Add("class", "jqmWindow");
selector.Attributes.Add("style", "width:1100px;height:600px;");
string script = "<script type=\"text/javascript\">$().ready(function() { $(" + "'#" + selector.ClientID + "').jqm({ modal: true }).jqmShow();});</script>";
//script = "<script type=\"text/javascript\">confirm('hello');</script>";
ScriptManager.RegisterStartupScript(this,this.GetType(),"duh",script,false);
}
}
This control is used on a page that has an update panel.
This all works well in Firefox and IE for the INITAL page load and any refreshes. However when I postback I get problems in IE and FF:
In IE, the div that represents the modal (in this case, selector) is shifted down and to the right about 500 px.
In firefox, the darkened area around the div becomes progressively darker with each postback.
If I remove the update panel from the host page (it's actually in the master page) this code works.
I have tried not executing the above code on postback but that simply disables jqmodal. I'm really stumped If anyone can help with this I would appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于,在 PostBack 上,jQuery div 向下并向右移动。 页面加载后的 div 看起来像这样(正确渲染):
异步回发后看起来像这样(渲染不正确):
删除更新面板解决了这个问题......我不知道这是问题。
我创建了一个项目,其中包含一些带有相关代码的页面。 这些页面是 site.master、List.aspx/cs 和 PartSelector.ascx/cs
The problem is that on PostBack, the jQuery div is moved down and to the right. The div after page load looks like this (renders correctly):
After Async PostBack it looks like this (renders incorrectly):
Removing the update panel solves this problem......I don't know that it is the problem.
I created a project with some pages with the just relevent code. The pages are site.master, List.aspx/cs and PartSelector.ascx/cs