DataKeyArray Class
Represents a collection of DataKey objects. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
The DataKeyArray class is used to store and manage a collection of DataKey objects. A DataKey object represents the primary key of a record in a data-bound control. In general, data-bound controls that display multiple records (such as the GridView control) use a DataKeyArray object to store the DataKey objects for the records displayed in the control.
The DataKeyArray class supports several ways to access the items in the collection:
Use the Item indexer to directly retrieve a DataKey object from the collection at a specific zero-based index.
Use the GetEnumerator method to retrieve an enumerator that can be used to iterate through the collection.
Use the CopyTo method to copy the items in the collection into an array, which can then be used to access the items in the collection.
To determine the total number of items in the collection, use the Count property.
The following code example demonstrates how to use the indexer to retrieve a DataKey object from a DataKeyArray collection.
The following code example demonstrates how to iterate through a DataKeyArray collection.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
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.