comment ajouter supprimer la boîte de dialogue de confirmation de champ de commande en vue de détail?

Je veux demander à l'utilisateur la confirmation quand il essaie de supprimer un enregistrement dans une vue de détail? J'ai commande déposées dans lesquelles showDeletebutton définie sur true.

J'ai trouvé comment faire de la confirmation pour les gridview, mais comment puis-je modifier pour correspondre à la vue de détails?

Code:

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
    //loop all data rows
    foreach (DataControlFieldCell cell in e.Row.Cells)
    {
       //check all cells in one row
       foreach (Control control in cell.Controls)
       {
            //Must use LinkButton here instead of ImageButton
            //if you are having Links (not images) as the command button.
            ImageButton button = control as ImageButton;
            if (button != null && button.CommandName == "Delete")
                //Add delete confirmation
                button.OnClientClick = "if (!confirm('Are you sure " + 
                       "you want to delete this record?')) return;";
        }
    }
}
}

Quelqu'un?

InformationsquelleAutor Sas | 2012-02-16