当托管在 UpdatePanel 中的控件上时,Jquery Colorbox 在关闭后不显示
所以我有一个用于 document.ready 函数的 Colorbox 设置:
$(document).ready(function () {
$('#btnMyButton').colorbox({
href: "./Modals/MyModal.aspx",
iframe: true,
height: 450,
width: 550,
opacity: .60,
overlayClose: false,
escKey: false,
onClosed: function () {
var mypage = Sys.WebForms.PageRequestManager.getInstance();
mypage._doPostBack('upGrid', '');
}
});
});
在关闭 colorbox 时,我会回发到我的更新面板(upGrid)。在 MyModal 中,我有一个关闭颜色框的按钮,如下所示:
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="parent.$.fn.colorbox.close(); return false;" CssClass="button cancel" />
更新面板包含一个网格,颜色框引导用户进入上传页面。如果他们成功上传文件,程序就会解析数据以填充网格。因此,当调用 colorbox 的 OnClosed 时,应该更新网格。
如果用户单击 btnMyButton 并继续单击模态上的 btnCancel,他们将无法再次单击 btnMyButton 以使颜色框再次加载模态。如果我将 btnMyButton 移到更新面板之外,它可以正常工作,但我希望更新面板内的 btnMyButton 能够处理隐藏/显示它,具体取决于用户是否已经上传了他们不应该看到的文件。
有没有人遇到/解决了在 ASP.NET 更新面板中关闭后 colorbox 无法重新显示的任何问题?
So I have a Colorbox setup for the document.ready function:
$(document).ready(function () {
$('#btnMyButton').colorbox({
href: "./Modals/MyModal.aspx",
iframe: true,
height: 450,
width: 550,
opacity: .60,
overlayClose: false,
escKey: false,
onClosed: function () {
var mypage = Sys.WebForms.PageRequestManager.getInstance();
mypage._doPostBack('upGrid', '');
}
});
});
On close of the colorbox I do a postback to my update panel (upGrid). In MyModal I have a button that closes the Colorbox as such:
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="parent.$.fn.colorbox.close(); return false;" CssClass="button cancel" />
The update panel contains a grid and the colorbox leads a user to an upload page. If they succesfully upload a file the program parses the data to fill in the grid. So when the OnClosed of the colorbox is called the grid should be updated.
If the user clicks btnMyButton and proceeds to click btnCancel on the Modal they are unable to click btnMyButton again to have the colorbox load the Modal again. If I move btnMyButton outside of the update panel it functions fine, but I wanted btnMyButton inside the update panel to handle hiding/showing of it depending on if the user has already uploaded a file they shouldn't see it.
Has anyone ran into/solved any issues with colorbox not redisplaying after close inside an ASP.NET update panel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$(document).ready() 和 pageLoad() 不是一样!
$(document).ready() and pageLoad() are not the same!