3
votes

I have a ListView control placed inside an UpdatePanel, there's a delete button when clicked I display a client side confirm box as "Are you sure you want to delete...." and on Ok click I call __doPostBack(this._source.name, ''); where source is the button clicked in which I pass it as a parameter to the method that shows the confirm box. The problem is that in framework 3.5 calling __doPostBack caused a partial postback but when I moved to framework 4 it doesn't, it causes a full postback the whole page is reloaded, and if I removed the confirm message and didn't use __doPostBack the delete is done asynchronously, I've been using this way a lot in framework 3.5 and it was ok so what's with framework 4 and __doPostBack?

Thanks in advance

1

1 Answers

1
votes

I'm currently on .Net 4.5

Using:

__doPostBack(btn.id, "OnClick"); caused full postback.

Changed to jQuery's (I'm on jquery-3.1.1.js):

$(btn.id).trigger('click'); gave asynchronous postback.

So full code:

function BtnConfirm(btn) {
    if (confirm("Please confirm")) {
        //__doPostBack(btn.id, "OnClick");
        $(btn.id).trigger('click');
    } else {
        return false;
    }
}