【问题标题】:asp.net get value from Jquery UI dialog back to first formasp.net 从 Jquery UI 对话框中获取值返回到第一个表单
【发布时间】:2013-01-31 14:18:27
【问题描述】:

我有下面的 JQuery 脚本

<script type="text/javascript">
     $(function() {
         $("#no-email-popup").dialog(
             {
                 autoOpen: false,
                 buttons: {
                     "ok": function() {
                     alert($('#new_email').val());
                     alert(window.top.$("#new_email_label.").val());
                   //  alert(window.top.$("#<%= new_email_label.ClientID %>").val());
                         $(this).dialog("close");

                     },
                     "cancel": function() {
                         $(this).dialog("close");
                     }
                 }

             }
        );
     });
</script>

and and modal asp.net 是

<div id="no-email-popup">
<label>Enter Email: </label>
<input type="text" id="new_email" />
</div>  

我想将 Pop up 中的值返回到 asp.net 页面并分配给那里的标签

<asp:Label ID="new_email_label" runat="server">test top window label</asp:Label>

我发现我什至无法更改此标签的值

请帮助如何获得顶级 asp.net 页面的价值

【问题讨论】:

    标签: c# jquery asp.net postback jquery-ui-dialog


    【解决方案1】:

    &lt;label/&gt; 上使用.val() 不会为您提供所述标签的内部html。您需要使用.html() 来检索它,或使用.html("something") 来设置它。

    【讨论】:

      【解决方案2】:

      在您的alerts 之后(或代替),尝试:$("#new_email_label").val($("#new_email").val());

      【讨论】:

      • 好吧,父标签甚至没有定义为能够分配它,我无法访问初始值来更改它
      猜你喜欢
      • 1970-01-01
      • 2011-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-08
      • 1970-01-01
      相关资源
      最近更新 更多