GridViewRow::DataItem Property
Gets the underlying data object to which the GridViewRow object is bound.
Assembly: System.Web (in System.Web.dll)
<asp:GridViewRow DataItem="Object" />
Property Value
Type: System::ObjectAn 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. |
| Topic | Location |
|---|---|
| How to: Set GridView Web Server Control Column Width Dynamically | Building ASP .NET Web Applications |
| How to: Set GridView Web Server Control Column Width Dynamically | Building ASP .NET Web Applications |
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note