Alex Rivera | Logout

How to add a "confirm delete" option in ASP.Net Gridview?

Asked 2011-01-25T13:17:09.063
37

How to add a "confirm delete" option in ASP.Net Gridview ?

Edit
Report

1 Answer

72

This code from a 2008 post by the user rtpHarry on the ASP.NET forums should do it:

<asp:TemplateField ShowHeader="False">
    <ItemTemplate>
        <asp:ImageButton ID="DeleteButton" runat="server" ImageUrl="~/site/img/icons/cross.png"
            CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete this event?');"
            AlternateText="Delete" />               
    </ItemTemplate>
</asp:TemplateField>
answered 2011-01-25T13:20:36.020

Your Answer