gpt4 book ai didi

asp.net - jquery UI 对话框和 __DoPostback

转载 作者:行者123 更新时间:2023-11-30 08:17:31 25 4
gpt4 key购买 nike

我的 ASP.NET 表单中的 jQuery-UI 对话框有问题:

$("#pnlReceiverDialog").dialog({
autoOpen:false,
modal: true,
height:220,
width:500,
resizable :false,
overlay: { opacity: 0.5,background: "black" },
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Ok": function() {
__doPostBack('ctl00$phContent$ctl00$LetterLocation$pupNewReceiver','')
}
}
});

pnlReceiverDialog 包含一个 ASP.NET TextBox

当我单击“确定”按钮时,表单回发但文本框没有值。

最佳答案

jQuery 对话框确实将字段移到了

之外,这就是为什么您在回发时看不到该值的原因。

你有两个选择:

  1. 在调用 __doPostBack 之前添加代码将对话框 div 移回到表单中——您可以使用类似 $("form")[0].appendChild($("div.yourdivdialog input:first") [0]); 来做到这一点。
  2. 在您的表单中添加一个隐藏字段(但不在对话框 div 中)并添加代码以将您的对话框字段复制到 __doPostBack 之前的隐藏字段。

关于asp.net - jquery UI 对话框和 __DoPostback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/371079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com