Intercept asp:LInkButton postback for client side confirmation dialog?
-
10-07-2019 - |
Question
I want to inject a confirmation dialog to allow the user to cancel the click before the postback occurs.
What's the cleanest way?
<asp:LinkButton ID="Btn_RemoveContractPeriod" Text="Remove"
runat="server" OnClick="OnRemoveContractPeriod_Click"/>
Solution
<asp:LinkButton ID="Btn_RemoveContractPeriod" Text="Remove" runat="server" OnClientClick="return confirm('Message')"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow