【问题标题】:UpdatePanel Jquery Modal Dialog update issueUpdatePanel Jquery 模态对话框更新问题
【发布时间】:2012-10-21 20:08:40
【问题描述】:

我有 Jquery 对话框,其中更新面板内有州和地区下拉列表,如下所示

<tr>
<td class="newLabel"><span >State </span></td><td>
   <asp:DropDownList ID="Dd_state" class="keyitem" runat="server" style="width:200px;"> 
    </asp:DropDownList></td> </tr>
<asp:UpdatePanel ID="updPnd_district" runat="server" onload="updPnd_district_Load">
    <Triggers> 
         <asp:AsyncPostBackTrigger  ControlID ="Dd_state" EventName="SelectedIndexChanged" />
   </Triggers>
<ContentTemplate>
    <tr><td class="newLabel"><span >District </span></td><td>
   <asp:DropDownList ID="dd_district" runat="server" style="width:200px;" class="keyitem"> </asp:DropDownList></td> </tr>
    </ContentTemplate>
</asp:UpdatePanel> 

我在按钮的点击事件上打开此对话框,该按钮将调用以下函数

function showNewDialog() {
   $('#<%=empnew.ClientID%>').dialog({ autoOpen: true ,modal: true, height: 550, width: 850 });
   $('#<%=empnew.ClientID%>').parent().appendTo($("form:first"));

}     

我的问题是在第一次从状态下拉回复后,更新面板不起作用,并且在回发后 div 的内容显示在页面中(对话框外)

我的代码有什么问题

请帮忙

【问题讨论】:

    标签: jquery asp.net updatepanel


    【解决方案1】:
    function showNewDialog() {
      var dlg = $('#<%=empnew.ClientID%>').dialog({ autoOpen: true ,modal: true, height: 550, width: 850 });
       dlg.parent().appendTo($("form:first"));
    
    }
    

    【讨论】:

    • 您何时以及如何调用该函数?回传后需要重新打开吗?
    • 试着把这段代码放在你的$(document).ready()&lt;% if (Page.IsPostback) { %&gt; $('#&lt;%=empnew.ClientID%&gt;').trigger('click'); &lt;% } %&gt;
    • 我在这一行出现错误 $('#').trigger('click'); 设计时出错:“预期表达式”
    • 将单引号改为双引号
    • 现在它可以工作但问题仍然存在......对话框将打开但一旦我从下拉列表中选择一个状态,然后对话框中的内容将附加到页面并且对话框停止响应
    猜你喜欢
    • 2013-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-13
    • 1970-01-01
    • 2010-10-08
    • 2016-05-24
    • 1970-01-01
    相关资源
    最近更新 更多