JavaScript Yes / No Previous ASP.NET Button Event

Hi, I am trying to learn more AJAX JavaScript. Basically, I would like to have a "Yes No" popup on the delete button that precedes the actual C # event. I could do all this in C #, but I know that doing this from the client side would be useful, as this would reduce the load on the server.

I don’t know exactly how to do this. Any ideas?

+3
source share
3 answers

You can use javascript function called confirm

onclick="return confirm ('Are you sure you want to delete this _____?');"

This text parameter is the text to be shown in modal format with yes and no.

Yes returns true, which allows the transfer to continue, but No returns false and stops the postback.

EDIT:

XaiSoft Cybernate, ASP.NET, OnClientClick, onclick.

+3

OnClientClick asp:Button.. JS.. - aspx/ascx/master:

<asp:Button id="cmdSubmit" OnClientClick="return confirm('Are you sure?')" runat="server" .../>
+2

You can also use jQuery instead of the ugly default confirmation. Here is a question considering this.

+1
source

All Articles