System.Web.UI.WebControls Namespace DetailsView Class
.NET Framework version 2.0
Returns the data key value of the current row in a DetailsView control.
Script |
[ Object objDataKeyvalue = ] DetailsView.SelectedValue |
This property can only be used programmatically; it cannot be set when declaring the control.
objDataKeyvalue |
An object specifying the data key value of the current row in a DetailsView control. |
The property is read only with no default value.
Use the SelectedValue property to determine the data key value of the current row in the DetailsView control.
When the DataKeyNames property is set, the DetailsView control automatically creates a DataKey object that contains the key/value pairs of the field or fields listed in the DataKeyNames property for the current record.
The DataKey object represents the primary key field or fields for the current record and is stored in the DetailsView control's DataKey property. Instead of using the DataKey property to access the data key value, you can instead simply use the SelectedValue property.
NOTE: When the DataKeyNames property lists multiple fields, this property returns only the value of the first field listed.