The event you are looking for is an event CellClick- with the help of this DataGridViewButtonColumnyou do not actually associate event handlers with specific buttons in the same way as with other buttons in your form.
From the event arguments returned by the cell click event, you can then determine which row and column were clicked, and what you want to do.
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewButton cell = (DataGridViewButtonCell)
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
}
Also, however, I think that you can really take a step back and think about the differences between the coding paradigms of winforms and webforms.
- , , , . winforms, , , .
, DataGridView, winforms.
, winforms - ( ).
FAQ DataGridView. DataGridView