Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Confirm box in asp.net

$
0
0

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;
         }
     }
    </script>

=========

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";
            clear();
            fillGrid();
        }
        else
        {

            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


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>