asp.net.ph

DetailsView.SelectedValue Property

System.Web.UI.WebControls Namespace   DetailsView Class


.NET Framework version 2.0

Returns the data key value of the current row in a DetailsView control.

Syntax


Script [ Object objDataKeyvalue = ] DetailsView.SelectedValue

This property can only be used programmatically; it cannot be set when declaring the control.

Property Value


objDataKeyvalue An object specifying the data key value of the current row in a DetailsView control.

The property is read only with no default value.

Remarks

Use the SelectedValue property to determine the data key value of the current row in the DetailsView control.

When the DataKeyNames property is set, the DetailsView 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 represents the primary key field or fields for the current record and is stored in the DetailsView control's DataKey property. Instead of using the DataKey property to access the data key value, you can instead simply use the SelectedValue property.

NOTE: When the DataKeyNames property lists multiple fields, this property returns only the value of the first field listed.

Skip Navigation Links



Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note