GridViewRow.DataItem Property

Gets the underlying data object to which the GridViewRow object is bound.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
virtual property Object^ DataItem {
	Object^ get ();
	void set (Object^ value);
}
/** @property */
public Object get_DataItem ()

/** @property */
public void set_DataItem (Object value)

public function get DataItem () : Object

public function set DataItem (value : Object)

Not applicable.

Property Value

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.

NoteNote:

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.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: