Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
ASP.NET: Add a confirmation popup to a Button
From Wiki
Summary: Ask the user for confirmation when they click a button
Need help with ASP.NET? Come and ask a question in our ASP.NET Forum
- <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return confirm('Are you sure you want to delete this record?');" />
Alternatively, you can add the confirmation message from your code-behind file in the Page Load event:
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- Button1.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this record?');")
- End Sub
This Hack is part of the ASP.NET Hacks collection



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.