When the DataKeyNames property is set, the DetailsView control automatically creates a DataKey object that represents the key field or fields for the current record. Use the DataKey property to get this DataKey object. This property is commonly used to obtain the keys and their corresponding values for the fields specified in the DataKeyNames property.
As a shortcut, you can also use the SelectedValue property to determine the value of the first key field listed in the DataKeyNames property.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)