List.ItemDataBind 事件

定义

在将 List 中的项绑定到数据时发生。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 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 

事件类型

示例

下面的代码示例演示如何使用 ItemDataBind 事件获取列表的状态设置的起始总计。 此代码是概述的较大示例的 List 一部分。

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

注解

创建 中的 List 项并绑定数据时,此事件处理程序会从任意表达式中设置列表项的属性。 中的 List 项的类型 MobileListItem为 。 此事件在绑定每个数据源项时引发。 这是使用 TextValue 属性筛选或分组集合中的MobileListItemCollection项的最佳时机。

适用于

另请参阅