views:

516

answers:

2

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

+4  A: 

DataKeyNames is where you specify the field names that comprise the key. It's compound to support compound keys.

DataKeys stores the actual key values.

JohnOpincar
From the gridview markup, does it matter if I use DataKeys="PersonId,FirstName" or DataKeyNames="PersonId,FirstName"
Xaisoft
+2  A: 

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

jalpesh
Thanks for the link!
Xaisoft
Your are welcome
jalpesh