Code:
<script language="javascript" type="text/javascript">function ConfirmDeleteSomething() {
return confirm("Warning: This Something will be permanently deleted. Would you still like to continue? ");}<asp:LinkButton ID="lbtnDelete" runat="server"OnClick="lbtnDelete_Click"
CausesValidation="false"
OnClientClick="return ConfirmDeleteSomething()">Delete Something
Summary:
To make sure that a user is actually sure they want to perform an unrecoverable action, such as deleting something, you may want to add a confirmation dialog warning the user of what their potential actions may do.
To do this using JavaScript simply add a function which calls the ‘confirm’ command and call that function through the ‘OnClientClick’ event of your button control in ASP.net.
Published by