I’ve the Javascript code to do a confirmation before deletion of some records
function confirmDelete()
{
if(confirm('Delete all?'))
{
return true;
}
else
{
return false;
}
}
I’ve the button code here
<asp:Button ID="btnDelete" runat="server" onClientClick="return confirmDelete();" onClick="btnDelete_click" />
If i’ve the button outside an update panel (basically i’m using RadAjaxPanel by Telerik) it is working fine. But when the button is inside an ajax panel, even if i click OK for deleting the records the server side code is not called.
Any ideas?
Your code is being prepended to the click handler that posts the action back to the server. You need to check if your result returns true/false then optionally continue executing the server-generated code.
This will result in client-side HTML like
allowing the server-generated code to be executed (i.e., no return is evaluated unless the confirmation fails).