I’m showing some data in a DataGridView using a list which I get from the Entity Framework. In this grid I set some database columns like the id to invisible.
When the user clicks on the gridview I need to know which object was clicked for further steps, the problem I cannot get the id column, neither through:
datagridview1.CurrentRow.Cells[0].Value // here I get only visible cells
nor through:
datagridview1.CurrentRow.DataBoundItem
It seems that through setting some columns to invisible the objects attached have anonymous types
Any ideas?
Thank you
I just tried this:
and it worked.
In my example column 0 is the hidden column, that contains the id property that you want to extract.