Edit

Share via


List.ItemDataBind Event

Definition

Occurs when an item in a List 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::ListDataBindEventHandler ^ ItemDataBind;
public event System.Web.UI.MobileControls.ListDataBindEventHandler ItemDataBind;
member this.ItemDataBind : System.Web.UI.MobileControls.ListDataBindEventHandler 
Public Custom Event ItemDataBind As ListDataBindEventHandler 

Event Type

Examples

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;
    }
}
Private Sub Status_DataBinding(ByVal sender As Object, _
    ByVal e As ListDataBindEventArgs)

    ' Increment initial counts
    Select Case e.ListItem.Value
        Case "done"
            doneCount += 1
        Case "scheduled"
            schedCount += 1
        Case "pending"
            pendCount += 1
    End Select
End Sub

Remarks

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.

Applies to

See also