clicking on a button clientSide does not cause postback
- by Andreas Niedermair
see this example:
<form runat="server">
<asp:Button runat="server" ID="btFoo" Text="asp.net button" />
<button id="btFoo2">open modal</button>
<script type="text/javascript">
$(document).ready(function() {
var btFoo = $('#<%= this.btFoo.ClientID %>');
btFoo.click(); // this will work and cause a postback
btFoo.click(function() {
alert('click triggered');
});
var dialog = $('<div/>');
dialog.text('please click yes');
dialog.dialog({
autoOpen: false,
open: function() {
var widget = dialog.dialog('widget');
widget.appendTo($('form'));
},
buttons: {
'YES': function() {
btFoo.click(); // this will cause a click, but no postback??!!
}
}
});
var btFoo2 = $('#btFoo2');
btFoo2.click(function() {
dialog.dialog('open');
return false;
});
});
</script>
</form>
any help would be appreciated, to get this example working!