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)

public:
property Object^ SelectedValue {
	Object^ get ();
}
/** @property */
public Object get_SelectedValue ()

public function get SelectedValue () : Object

Not applicable.

Property Value

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.

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.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: