FormView.DataItem Property

Gets the data item bound to the FormView control.

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

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

public function get DataItem () : Object

Not applicable.

Property Value

An Object that represents the data item bound to the FormView control.

Use the DataItem property to access the data item bound to the FormView control. The data item is often used to access the field values of the current record directly. The type of the Object returned by this property varies depending on the data source. For example, when a SqlDataSource control is bound to the FormView control, a DataRowView object is returned.

NoteNote:

This property is available only after data binding has occurred. Before data binding occurs, this property returns a null reference (Nothing in Visual Basic). This property is also not applicable when the FormView control is in insert mode and returns a null reference (Nothing in Visual Basic).

The following example demonstrates how to use the DataItem property to determine the value of a field in the data item.

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: