I am using DataGridView in WinForms and by this piece of code I am assigning it columns and values
dataGrid.DataSource = sourceObject;
only by this line all the columns and values into the grid.
How do I handle the onClick event of a specific row or field. I want to do edit a particular item in the grid but I cannot find any way to send the id of an item from the event method.
There is class DataGridViewEventHandler which I do not understand?
I have also tried to add columns manually as a buttons but I did not find way to assign it action method onClick.
You cannot find “OnClick” event for cell inside DataGridView, as it does not exist. Have a look at MSDN Page for DataGridView Events provided for Cell Manipulation and Events
Here are some samples from MSDN, about the events which you may use
Sample CellMouseClick Event and Handler
Sample CellClick Event and Handler
Hope this helps