Breyta

Deila með


ObjectList.ItemDataBind Event

Definition

Occurs when an item in an ObjectList is bound to data. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

public:
 event System::Web::UI::MobileControls::ObjectListDataBindEventHandler ^ ItemDataBind;
public event System.Web.UI.MobileControls.ObjectListDataBindEventHandler ItemDataBind;
member this.ItemDataBind : System.Web.UI.MobileControls.ObjectListDataBindEventHandler 
Public Custom Event ItemDataBind As ObjectListDataBindEventHandler 

Event Type

Examples

The following code example demonstrates how to use ItemDataBind event. You can use either the ListItem or DataItem property of the ObjectListDataBindEventArgs collection to determine further action. This example is part of a larger example for the ObjectList overview.

// Count items in each department
private void List1_ItemDataBind(object sender, ObjectListDataBindEventArgs e)
{
    switch (((GroceryItem)e.DataItem).Department)
    {
        case "Bakery":
            bakeryCount++;
            break;
        case "Dairy":
            dairyCount++;
            break;
        case "Produce":
            produceCount++;
            break;
    }
}
' Count items in each department
Private Sub List1_ItemDataBind(ByVal sender As Object, ByVal e As ObjectListDataBindEventArgs)
    Select Case CType(e.DataItem, GroceryItem).Department
        Case "Bakery"
            bakeryCount += 1
        Case "Dairy"
            dairyCount += 1
        Case "Produce"
            produceCount += 1
    End Select
End Sub

Remarks

When an item in an ObjectList is created and data-bound, this event handler sets the properties of the list item from arbitrary expressions. An item in an ObjectList control is of type ObjectListItem.

Applies to

See also