Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

DetailsView.DataItem Property

Gets the data item bound to the DetailsView control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
[<BrowsableAttribute(false)>]
abstract DataItem : Object with get
[<BrowsableAttribute(false)>]
override DataItem : Object with get

Property Value

Type: System.Object
An Object that represents the data item bound to the DetailsView control.

Implements

IDataItemContainer.DataItem

Use the DataItem property to access the data item bound to the DetailsView 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 DetailsView 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 DetailsView control is in insert mode and returns a null reference (Nothing in Visual Basic).

The following code 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.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.