ObjectList.ItemDataBind Event

 

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 the www.asp.net/mobile Web site.

Namespace:   System.Web.UI.MobileControls
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

public event ObjectListDataBindEventHandler ItemDataBind

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.

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;
    }
}

.NET Framework
Available since 1.1
Return to top
Show: