Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ItemDataBind Event
Collapse the table of content
Expand the table of content

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Show:
© 2015 Microsoft