List.ItemDataBind Event

Occurs when an item in a List is bound to data.

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

public event ListDataBindEventHandler ItemDataBind
<asp:List OnItemDataBind="ListDataBindEventHandler" />

When an item in a List is created and data-bound, this event handler sets the properties of the list item from arbitrary expressions. An item in a List is of type MobileListItem. This event is raised as each data source item is bound. This is the best time to filter or group items in the MobileListItemCollection collection, by using the Text or Value Property.

The following code example demonstrates how to use the ItemDataBind event to get the starting totals of status settings for the list. This code is part of a larger example for the List overview.

private void Status_DataBinding(object sender, 
    ListDataBindEventArgs e)
{
    // Increment initial counts 
    switch (e.ListItem.Value)
    {
        case "done":
            doneCount += 1;
            break;
        case "scheduled":
            schedCount += 1;
            break;
        case "pending":
            pendCount += 1;
            break;
    }
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft