Get single primary key value from datagridview in c # window forms

I need to get the primary key value or any other key that I set from the selected row in a datagridview without creating a hidden column.
I want the aspview gridview function to have the DataKeyNames property

+3
source share
1 answer

It really depends on how you fill the grid, but you can use the Tagfor property DataGridViewRowto hold the row key.

Tag the property can contain any object so that you can set it at any time convenient for you.

+5
source

Source: https://habr.com/ru/post/1783610/


All Articles