C# – the difference between a Gridview’s DataKeys property and DataKeyNames

asp.netc++gridview

They seem to be equal. Can both have multiple keys separated by a comma.

Best Solution

Both are diffrent datakeysname are storing the name of the primay key column while datakeys will have the values for the that column.

See the following examples. http://www.highoncoding.com/Articles/87_Accessing_Invisible_Columns_of_GridView_Control.aspx