System.Web.UI.WebControls Namespace FormView Class
.NET Framework version 2.0
Returns the data key value of the current row in a FormView control.
Script |
[ Object objDataKeyvalue = ] FormView.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 FormView 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 FormView control.
When the DataKeyNames property is set, the FormView 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 FormView 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.