I am trying to hook a jquery style yes|no confirmation box before a button posts back.
What should happen
What currently happen
So, how can I get the button event handler to fire? Right monw it just goes to page load event.
<asp:Button ID="btnSetActive" runat="server" Text="Set as Active" OnClientClick="AllBrandsConfirmation(); return false;" onclick="btnSetActive_Click" />
$(function () {
// Set all brands (yes button)
$('#setAllBrandsConfirmation #yes').click(function () {
$.unblockUI();
__doPostBack('ctl00_ctl00_oCPH1_Content_btnSetActive', '');
});
// Set all brands (no button)
$('#setAllBrandsConfirmation #no').click(function () {
$.unblockUI();
});
});
// All brands confirmation
function AllBrandsConfirmation() {
$.blockUI({ message: $('#setAllBrandsConfirmation') });
}
I just figured it out... well google helped :) Apparently in the first argument for the doPostBack method you need to use the controls uniqueId, not the id value. Once I changed that it triggered the event.