• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Message before deletion


I have a gridview, and Edit/delete options for each row.  When users clicks on delete, i want to display a pop up warning window asking " are you sure you want to delete this row? "  with yes or cancel button in this popup window.  Please give me the code to do so in javascript or VB.net.

1 Solution
suran78Author Commented:
here is the autogenerated delete option, how can i add a delete confirmation message to it?

<asp:DetailsView ID="dvCCenter" runat="server" AutoGenerateRows="False" DataKeyNames="intCID"
        DataSourceID="CCenters" OnDataBound="CCenter_DataBound" AutoGenerateInsertButton="True"
Hi Suran78,

u cannot attach an javascript confirm message before delete for an autogenerated delete button...

u will have to create a templatefield with the delete button and attach the javascript as follows:

<asp:DetailsView ID="SampleDetailsView" runat="server" AutoGenerateDeleteButton="false">
                    <asp:TemplateField HeaderText="Test">
                            <asp:Label ID="TestLabel" runat="server" Text='<%# Bind("Id") %>'>
                            <asp:Button ID="TestButton" runat="server" Text="Delete"
                             OnClientClick="return confirm('Are u Sure u want to Delete?')" />

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now