我需要为 jQuery 模态对话框中的 asp.net 按钮做一个回帖。我拥有的标记是这样的
<div id="content">
<h1>
Join Our Community</h1>`enter code here`
<hr />
Some Context..
<br />
<br />
Some Context..
<hr />
<br />
<!-- Modal Dialog -->
<a id="tos" href="#serviceterms" title="You must agree with our tems of service.">Click
HERE to Agree to our Terms </a>
<div style="display: none">
<div id="serviceterms" style="width: 440px; height: 250px; overflow: auto;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<br />
<br />
Some Context..
<br />
<br />
<hr />
<input type="button" value="Yes" onclick="ToS_Agree()" />
<input type="button" value="No" onclick="ToS_NotAgree()" />
</div>
</div>
<br />
<br />
<asp:Button ID="HiddenButton" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Button ID="SubmitButton" runat="server" Text="Submit Form" Enabled="False" ClientIDMode="Static"
OnClick="SubmitButton_Click" />
<br />
<br />
<asp:Label ID="LabelResult" runat="server" Text=""></asp:Label>
在 jQuery 部分中,代码类似于
$(document).ready(function () {
$("#tos").fancybox({
'titlePosition': 'inside',
'modal': 'true',enter code here
'transitionIn': 'none',
'transitionOut': 'none'
});
});
function ToS_Agree() {
$('#SubmitButton').removeAttr('disabled');
__doPostBack('<%# HiddenButton.ClientID %>', '')
}
function ToS_NotAgree() {
$('#SubmitButton').attr('disabled', 'disabled');
$.fancybox.close();
}
问题:当我在模式对话框中点击“是”按钮时,它会正确回发。但它会将我定向到 page_load 事件正文,而不是转到 Button1_Click 正文。请在这里帮助我。我个人认为必须有一种方法可以使用 jQuery 获得我想要的事件主体。