我需要爲jQuery模式對話框中的asp.net按鈕做回發。該標記我已經是這樣的asp.net button使用jQuery回發
<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來獲得我想要的事件體。
http://stackoverflow.com/questions/6213580/dopostback-not-working-as-expected/6214387 –