WebDesktopToolbar - Javascript confirm dialog on click

7 replies. Last post: May 5, 2011 4:57 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Jalal UddinMember

Hello,

I have a delete button in my toolbar, i also have a server side and a client side event for the button.

The button is also allowed to do AutoPostBack.

Now, what i want is when the user click the delete button, it will call the client side event and there i will open a javascript confirmation. If user cancels the confirmation, then nothing will happen (no post back will happen/no server side event execution), otherwise the server side event will be executed.


I want to give an Asp.net version of the task that i am trying.

<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="Delete_Click" OnClientClick="return confirm('Are you sure that you want to delete?');" />



But the problem i face is when i set AutoPostBack = Yes, then clicking the button fires both server side and client side event altogether. without waiting for the confirmation box, the page postbacks. I tried to stop the postback by putting a javascript alert inside the client side event, but still post back happens, ignoirng the alert.


So my question is, is it possible to cancel the serverside event from the clientside event for toolbar.


Please help me on this. Thanks in advance.

All times are GMT -5. The time now is 6:23 PM.
Previous Next