I have a grid view and this grid view has a DataKeyNames="person_id"
Now I want this key as a primary key for the grid so no allowed duplicates .
How to prevent duplicate data through using DataKeyNames
GridView is a presentation layer. It should not do any validation. I suggest you to check for duplicates in Data Access layer.