Thread: GridView Delete
View Single Post
  #1 (permalink)  
Old March 16th, 2007, 09:04 AM
DARSIN DARSIN is offline
Friend of Wrox
 
Join Date: Sep 2004
Location: , , India.
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default GridView Delete

I had a Image button on a gridview column and I want to display a confirm box before the delete event is fired.
I have used this code to achive it
void gridView_RowCreated(object sender,GridViewRowEventArgs e )
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

                ImageButton imgDelete = ((ImageButton)(e.Row.Cells[6].Controls[2]));
                if (imgDelete.CommandName.ToUpper() == "DELETE")
                {
                    string message = UserManagementRessources.DeleteConfirm;
                                        imgDelete.OnClientClick = "if ( confirm('" + message + "') ) { return true; } else { return false; };";

                }



            }
        }

but the RowDeleteing event is not fired

Reply With Quote