DetailsView.DataKeyNames Property
Assembly: System.Web (in system.web.dll)
public: virtual property array<String^>^ DataKeyNames { array<String^>^ get (); void set (array<String^>^ value); }
/** @property */ public String[] get_DataKeyNames () /** @property */ public void set_DataKeyNames (String[] value)
public function get DataKeyNames () : String[] public function set DataKeyNames (value : String[])
Property Value
An array that contains the names of the key fields of 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 DetailsView control automatically creates a DataKey object that represents the key field or fields for the current record and stores it in the DataKey property. When the AutoGenerateColumns property is also set to true, the DetailsView control automatically ensures that the field or fields specified in the DataKeyNames property are read-only.
Note |
|---|
| You must set the DataKeyNames property for the automatic updating, deleting, and inserting features of the DetailsView control to work. |
If the Visible property of a row field is set to false, the row is not displayed in the DetailsView control and the data for the row does not make a round trip to the client. If you want the data for a row that is not visible to make a round trip, add the field name to the DataKeyNames property.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note