Have a look at this code:
<asp:button id="save" runat="server" text="Save" onclick="save_Click" onclientclick="return confirm('Are you sure you want to save selected records?');" />
This code will ask you to confirm the action,if you press yes,then only save_Click will be executed.
:doh:
[EDIT]:
\\Do your calculations here
if(your condition1)
{
Response.Write("<script type='text/javascript'>");
Response.Write("alert('This is alert1 if condition1 satisfied.');");
Response.Write("</script>");
}
else
{
Response.Write("<script type='text/javascript'>");
Response.Write("alert('This is alert2 if condition1 does not satisfy.');");
Response.Write("</script>");
}
Regards..:)