jQuery UI的对话与更新面板ASP按键触发
问题描述:
我有一个jQuery模态窗口一个问题,从更新面板内的按钮被称为..jQuery UI的对话与更新面板ASP按键触发
这里的见解..
的Javascript用于开启在aspx页面jQuery的模态对话框..
<script type='text/javascript'>
function openModalDiv(divname) {
$('#' + divname).dialog({
autoOpen: false,
bgiframe: true,
closeOnEscape: true,
modal: true,
resizable: false,
height: 'auto',
buttons: { Ok: function() { closeModalDiv(divname) } },
open: function (event, ui) { jQuery('.ui-dialog-titlebar-close').hide(); }
});
$('#' + divname).dialog('open');
('#' + divname).parent().appendTo($('form:FrmSearch'));
$('#' + divname).css('overflow', 'hidden')
}
function closeModalDiv(divname) {
$('#' + divname).dialog('close');
}
</script>
在aspx页面..按钮
<asp:UpdatePanel ID="upDialogs" runat="server">
<ContentTemplate>
<asp:Button ID="btnOpenDialog" runat="server" Text="Open Dialog" onclick="btnOpenDialog_Click" />
</ContentTemplate>
</asp:UpdatePanel>
这需要从通过JavaScript代码隐藏调用的股利..
<div id="ErrorDiv2" title="Error" style="visibility:hidden">
<p><span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>Please select an option among the results and try again!</p>
</div>
最后后面的代码..
protected void btnOpenDialog_Click(object sender, EventArgs e)
{
if (ProfileID == null)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorDivOpen", "document.getElementById('ErrorDiv2').style.visibility = 'visible';", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorDivShow", "openModalDiv('ErrorDiv2');", true);
}
}
现在详细问题.. 没有更新面板中的模态对话框持久性有机污染物很不错,但充分后回..
我想只有部分回发,因此正在使用更新面板..
以下是我试过的解决方案..
- 将更新面板添加到现有的div,dint工作。
- 添加RUNAT =“服务器”沿着股利,仍然力工作的最新面板..
任何一个可以帮助我与可能的解决方案?
答
感谢您的快速回复,但我找到了另一种解决方案。
我在Div中添加了更新面板和runat参数。
<asp:UpdatePanel ID="upErrorDiv" runat="server"><ContentTemplate>
<div runat="server" id="ErrorDiv2" title="Error" style="visibility:hidden">
<p><span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>Please select an option among the results and try again!</p>
</div>
</ContentTemplate></asp:UpdatePanel>
更改后面的代码为。
if (ProfileID == null)
{
ScriptManager.RegisterStartupScript(ErrorDiv2,this.GetType(), "ErrorDivOpen", "document.getElementById('ErrorDiv2').style.visibility = 'visible';", true);
ScriptManager.RegisterStartupScript(ErrorDiv2,this.GetType(), "ErrorDivShow", "openModalDiv('ErrorDiv2');", true);
return;
}
答
你可以尝试在UpdatePanel中注入JavaScript到Literal控件中,是否注册到ClientScriptManager?
克里斯