我在asp.net页面中有模态div。这个表单有文本框,我应该在提交之前检查。我没有看到btnReportModal_Click中的值。
有人可以帮忙吗?
=========我的aspx页面=================================== =====
<div id="modalpopup" style="display: none;">
<div class="row">
<div class="input-group">
<span class="input-group-addon">Qty 1</span>
<asp:TextBox ID="txtQty1" runat="server"></asp:TextBox>
</div>
<div class="input-group">
<span class="input-group-addon">Qty 2</span>
<asp:TextBox ID="txtQty2" runat="server"></asp:TextBox>
</div>
</div>
</div>
<asp:Button runat="server" ID="btnReportModal" class="hidden" Text="" OnClick="btnReportModal_Click" />
=========脚本=============================
function ShowPopup(param) {
$(function () {
$("#modalpopup").dialog({
modal: true,
buttons: {
"Submit": function () {
$("[id*=btnReportModal]").click();
},
"Close": function () {
$("#modalpopup").dialog('close');
}
},
close: function (event, ui) {
__doPostBack(this.name, '');
}
});
$("#modalpopup").dialog('open');
});
};
========代码背后================
Protected Sub btnReportModal_Click(sender As Object, e As EventArgs) Handles btnReportModal.Click
dim txt as string = txtQty1.Text
'txtQty1.Text - >> I see empty
End Sub
答案 0 :(得分:0)
安东。我必须把它留在窗体中,因为我在打开模态之前给文本框提供了默认值。我使用$(“#modalpopup”)。dialog({...})。parent()。appendTo(“form”); 谢谢