Confirmation notice

Asked

Viewed 42 times

-1

I am in a project in ASP.NET and I entered a situation where you need a warning for a button.

This button deleted the file, but without any kind of confirmation and in case of unintentional clicking would have your file deleted.

And so I wanted to know how I can put a warning like: 'Do you really want to delete? ' and wait for OK confirmation to delete or else a way to Cancel the action.

In some researches I got the answer I sent below that in my case serves, but would have some other way without using javascript?

  • Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English (short version). If the help is very simple it is still possible to do in the comments.

  • @Maniero, I found nothing on the site on this subject and only on other sites I got the answer, I thought maybe it would be good to share.

  • @Pedrobelino And he did well, just improve the question for something more people could answer. See how to elaborate a [mcve], for example, and try to detail the problem better. We can also observe that the question is somewhat biased, given that asked the question about ASP.NET and answered using Javascript. If you do this search in JS, you will find numerous duplicates. See https://answall.com/search?q=%5Bjs%5D+confirm

  • @Maniero got it, do you think it’s better? is that my application is in Asp.net and searching for Asp I didn’t find anything, although I used js.

1 answer

0


As described in the question, in some researches, I was able to solve only using js within my application even though in Asp.net.

A very simple way was to put the Onclientclick on the button itself and do all this validation and after that it does the Oncommand.

<asp:LinkButton runat="server" ID="exclr" OnClientClick="return confirm('Deseja realmente excluir?');" Text="Excluir" OnCommand="exclr_Command"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.