我有一个jQuery UI Dialog在我的ASP.NET页面上工作得很好:
jQuery(function() {
jQuery("#dialog").dialog({
draggable: true,
resizable: true,
show: 'Transfer',
hide: 'Transfer',
width: 320,
autoOpen: false,
minHeight: 10,
minwidth: 10
});
});
jQuery(document).ready(function() {
jQuery("#button_id").click(function(e) {
jQuery('#dialog').dialog('option', 'position', [e.pageX + 10, e.pageY + 10]);
jQuery('#dialog').dialog('open');
});
});
Run Code Online (Sandbox Code Playgroud)
我的div:
<div id="dialog" style="text-align: left;display: none;">
<asp:Button ID="btnButton" runat="server" Text="Button" onclick="btnButton_Click" />
</div>
Run Code Online (Sandbox Code Playgroud)
但btnButton_Click永远不会被调用......我该如何解决?
更多信息:我添加了此代码以将div移动到表单:
jQuery("#dialog").parent().appendTo(jQuery("form:first"));
Run Code Online (Sandbox Code Playgroud)
但仍然没有成功......
我在 < div> 标记中有 Asp.net 文本框,单击“btnReply”后,< div> 通过 Jquery 对话框显示,因此用户在文本框中写下想法,然后单击“发送”按钮(jquery 对话框按钮)并发回。
但服务器端的 asp.net 文本框值为 null 。为什么 ?我的代码在这里:
<div id="ReplyDiv" style="display:none;">
<asp:TextBox ID="txtReply" runat="server" Textmode="MultiLine"/>
</div>
<input type="button" id="btnReply" onclick="javascript:retuen ShowReplyDialog();"/>
<asp:Button ID="AspBtnReply" runat="server" OnClick="AspBtnReply_Click" class="hidden"/>
/*-----Jquery script----*/
<script type="text/javascript">
function ShowReplyDialog()
{
$("#ReplyDiv").dialog({
width: 580,
buttons: {
"Close": function () { $(this).dialog("close");} ,
"Send" : function () {
//----Call Asp.net server method here
$("#<%=AspBtnReply.ClientID %>").click();
}
}
}).parent().appendTo($("form:first"));
}
</script>
Run Code Online (Sandbox Code Playgroud)