DataItem Property (ObjectListDataBindEventArgs)
Returns the specified data object of the list item that is being bound. This property is available only on a request where the list item is data bound; on subsequent postbacks, it is always null.
public Object DataItem {
get
}
Example
The following example demonstrates how to access the members of an object bound to an object list item.
Public Sub confirmBound(ByVal sender As Object,
ByVal e As ListDataBindEventArgs)
Select Case CType(e.DataItem, Book).InStock
Case "Yes"
'Add code here for a book that is in stock.
Case "No"
'Add code here for a book that is not in stock.
End Select
End Sub
[C#]
void confirmBound(object sender, ObjectListDataBindEventArgs e)
{
switch (((Book)(e.DataItem)).InStock)
{
case "Yes":
//Add code here for a book that is in stock.
break;
case "No":
// Add code here for a book that is not in stock.
break;
}
}
See Also
Applies to: ObjectlistDataBindEventArgs Class