System.Web.UI.WebControls.GridView.DataKeys Property

Gets a collection of System.Web.UI.WebControls.DataKey objects that represent the data key value of each row in a System.Web.UI.WebControls.GridView control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public virtual DataKeyArray DataKeys { get; }

Value

Documentation for this section has not yet been entered.

Remarks

When the GridView.DataKeyNames property is set, the System.Web.UI.WebControls.GridView control automatically creates a System.Web.UI.WebControls.DataKey object for each row in the control. The System.Web.UI.WebControls.DataKey object contains the values of the field or fields specified in the GridView.DataKeyNames property. The System.Web.UI.WebControls.DataKey objects are then added to the control's GridView.DataKeys collection. Use the GridView.DataKeys property to retrieve the System.Web.UI.WebControls.DataKey object for a specific data row in the System.Web.UI.WebControls.GridView control.

Note:

You can use the GridView.SelectedDataKey property to retrieve the System.Web.UI.WebControls.DataKey object for the currently selected row. You can also use the GridView.SelectedValue property to retrieve the data key value for the currently selected row directly.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0