Confirm Box in asp.net RRS feed

  • Question

  • Helloo All,

    how to use confirm box in asp gridview when using row deleting event in gridview.... here am using delete (type as image) from command field

    i have given below the code which i have using now... but its not working properly...

    client side


        <script type="text/javascript">
         function confirmation() {
             if (confirm('are you sure you want to delete ?')) {
                 return true;
             } else {
                 return false;


    Server side


      protected void gdv_RowDeleting1(object sender, GridViewDeleteEventArgs e)
            Session["Agent_Id"] = gdv.Rows[e.RowIndex].Cells[0].Text;
            if (DeleteData())

                lblMsg.Visible = true;
                lblMsg.Text = "Deleted Successfully";

                lblMsg.Visible = true;
                lblMsg.Text = "Error on Deleting..";


    but its working well when it using button when it call like this

      <asp:Button ID="btnDelete"  runat="server" Text="Delete" OnClientClick="return confirmation();"
                    Width="60px" Visible="False" onclick="btnDelete_Click"/>

    my problem is how can i call the abouve javascript function in row deleting event....

    does any one knows to solve my problem please help me to find a better solution,.....

    thanks in advance

    • Moved by Mike Danes Saturday, April 26, 2014 8:23 AM asp.net related
    Saturday, April 26, 2014 7:31 AM