Asp.Net 3.5 / WebForms (no ajax)
I am trying to update a delete confirm box with jquery & UIBlock. Old code looks something like this...
<asp:LinkButton OnClientClick="return confirm('Are you sure you want to delete?')" runat="server" ID="DeleteButton" OnClick="DeleteButton_OnClick">Delete</asp:LinkButton>
What is the best practice to postpone and then continue a postback with jquery & asp.net? I haven't found a clean way/example/guidance on this. Dave Ward (encosia.com) has some examples w/ UIBlock but none of them uses UIBlock as a confirmation / modal popup.
Thanks for any help/pointers.
Answer
<a href="#" id="delete">
<span>Delete?</span>
</a>
<div id="question" style="display:none; cursor: default">
<h1>Are you sure you want to delete?</h1>
<asp:LinkButton runat="server" Text="Yes" OnClick="DeleteButton_OnClick"></asp:LinkButton>
<a href="#" id="no"><span>No</span></a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#delete').click(function(ev) {
ev.preventDefault();
$.blockUI({ message: $('#question'), css: { width: '275px'} });
});
$('#no').click(function() {
$.unblockUI();
return false;
});
});
</script>