Share via


List.ItemDataBind 事件

定義

List 中的項目繫結至資料時會發生。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 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 

事件類型

範例

下列程式代碼範例示範如何使用 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 Property 篩選或群組集合中MobileListItemCollection專案的最佳時機。

適用於

另請參閱