GridViewRow::DataItem Property
.NET Framework (current version)
Gets the underlying data object to which the GridViewRow object is bound.
Assembly: System.Web (in System.Web.dll)
public: property Object^ DataItem { virtual Object^ get(); virtual void set(Object^ value); }
Property Value
Type: System::Object^An Object that represents the underlying data object to which the GridViewRow object is bound.
Use the DataItem property to access the properties of the underlying data object to which the GridViewRow object is bound. The DataItem property is only available during and after the RowDataBound event of a GridView control.
Note |
|---|
This property applies only to data rows. |
The following example demonstrates how to use the DataItem property to retrieve a field value. The value is then used to pre-select an item in a DropDownList control displayed when a row is in edit mode.
.NET Framework
Available since 2.0
Available since 2.0
Show:
