Export (0) Print
Expand All

FormView::DataKeyNames Property

Gets or sets an array that contains the names of the key fields for the data source.

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

[TypeConverterAttribute(typeof(StringArrayConverter))]
public:
virtual property array<String^>^ DataKeyNames {
	array<String^>^ get ();
	void set (array<String^>^ value);
}
<asp:FormView DataKeyNames="value" />

Property Value

Type: array<System::String>
An array that contains the names of the key fields for the data source.

Use the DataKeyNames property to specify a comma-separated list of field names that represent the primary key of the data source. 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 is then stored in the DataKey property.

NoteNote:

You must set the DataKeyNames property for the built-in updating, deleting, and inserting features of the FormView control to work.

The following example demonstrates how to use the DataKeyNames property to specify the key field for the data source bound to the FormView control.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft