ComponentOne DataObjects for .NET
FromDataItem Method

C1.Data.2 Assembly > C1.Data Namespace > C1DataRow Class : FromDataItem Method
An object exposed by a C1DataObjects data source to bound controls.
Gets the C1DataRow object associated with a row object (data item) obtained from data binding.
Syntax
'Declaration
 
Public Shared Function FromDataItem( _
   ByVal dataItem As System.Object _
) As C1DataRow
public static C1DataRow FromDataItem( 
   System.object dataItem
)

Parameters

dataItem
An object exposed by a C1DataObjects data source to bound controls.

Return Value

Returns C1DataRow object.
Remarks
This method allows programmers to obtain the C1DataRow object corresponding to an object returned by a C1DataObjects data source, from its IList interface (used in data binding). For example, such objects belong to a CurrencyManager.List collection, and CurrencyManager.Current returns one of them.

Objects obtained by bound controls from a C1DataObjects data source are not C1DataRow objects, although each of them corresponds to a C1DataRow object. The FromDataItem method represents this correspondence. Bound controls can get all information they need from the objects returned by the IList interface. However, if you want to work with such objects (data items) in code, get or set their field values, you need to treat them as C1DataRow objects. This method allows you to obtain a C1DataRow from an untyped row object (data item) returned by the IList interface. For example, C1WebGrid (bound grid control in ComponentOne Studio for ASP.NET) has a C1GridItem.DataItem property. This property returns an object obtained by the grid from the data source. It is not a C1DataRow object, so you must use C1DataRow.FromDataItem(C1GridItem.DataItem) to obtain the C1DataRow object corresponding to that data item.

See Also

Reference

C1DataRow Class
C1DataRow Members
C1DataRow Class