you can use CellContentClick event
  1. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)  
  2. {  
  3.     var senderGrid = (DataGridView)sender;  
  4.   
  5.     if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&  
  6.         e.RowIndex >= 0)  
  7.     {  
  8.         // Button Clicked - Execute your Code Here  
  9.     }  
  10. }  
 
or you can try this way.
  1. private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)  
  2. {  
  3.    if (e.Control is Button)  
  4.    {  
  5.       Button button = e.Control as Button;  
  6.       button.Click -= new EventHandler(DGVbutton_Click);  
  7.       button.Click += new EventHandler(DGVbutton_Click);  
  8.    }  
  9. }  
  10.    
  11. private void DGVbutton_Click(object sender, EventArgs e)  
  12. {  
  13.    int row = this.dataGridView1.CurrentCell.RowIndex;  
  14.    int col = this.dataGridView1.CurrentCell.ColumnIndex;  
  15.      
  16.    MessageBox.Show("Button in Cell[" +  
  17.    col.ToString() + "," +  
  18.    row.ToString() + "] has been clicked");  
  19. }