I’ve searched for a way to display a confirmation box when a certain button is pressed.
The only problem I have, is that the confirmation box shows twice.
Code:
<dx:ASPxButton ID="btnDel" runat="server" onClick="btnDel_Click" Text="Delete">
and in Page_Load:
btnDel.Attributes.Add("onclick", "return confirm('Are you sure?');");
the button control you are using is devexpress button and it implements it’s own ClientSideEventCollection in which you can add any javascript. you can do it like following
Here
e.processOnServeris a boolean which decides if the server trip should be executed, so we assigned the result of confirm to this boolean.you can find more about ClientSideEvents on a dev express control, in the devexpress docs here