FormView.SelectedValue Property

 

Gets the data key value of the current record in a FormView control.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<BrowsableAttribute(false)>]
member SelectedValue : Object with get

Property Value

Type: System.Object

The data key value of the current record in a 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 DataKey property. Instead of using the DataKey property to access the data key value, you can use the SelectedValue property as a shortcut.

System_CAPS_noteNote

When the DataKeyNames property lists multiple fields, this property returns the value of the first field listed.

The following example demonstrates how to use the SelectedValue property to determine the value of the key field.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: