DetailsView::DataKey Property
Gets a DataKey object that represents the primary key of the displayed record.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
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.
Note |
|---|
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, 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)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note