This documentation is archived and is not being maintained.

GridViewUpdateEventArgs::Keys Property

Gets a dictionary of field name/value pairs that represent the primary key of the row to update.

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

public:
property IOrderedDictionary^ Keys {
	IOrderedDictionary^ get ();
}

Property Value

Type: System.Collections.Specialized::IOrderedDictionary
A System.Collections.Specialized::IOrderedDictionary object containing field name/value pairs that represent the primary key of the row to update.

When the DataKeyNames property of a GridView control is set, use the Keys property (dictionary) to access the value of the primary key in the row to update.

NoteNote:

To access the values of the non-key fields, use the NewValues or OldValues properties. The NewValues property contains the updated values, while the OldValues property contains the original values.

The Keys dictionary is automatically populated with the name/value pairs of the field or fields specified in the DataKeyNames property. If multiple fields form the primary key, a separate entry is added to the Keys dictionary for each key field.

To determine the name of a key field, use the DictionaryEntry::Key property of a System.Collections::DictionaryEntry object contained in the Keys dictionary. To determine the value of a key field, use the DictionaryEntry::Value property.

The following example demonstrates how to use the Keys property to access the values of the key fields in the row to update. The values are then written to a log file of updated records.

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
Show: