Partager via


ListDataBindEventArgs, classe

Fournit des paramètres pour un événement ItemDataBind.

Espace de noms : System.Web.UI.MobileControls
Assembly : System.Web.Mobile (dans system.web.mobile.dll)

Syntaxe

'Déclaration
Public Class ListDataBindEventArgs
    Inherits EventArgs
'Utilisation
Dim instance As ListDataBindEventArgs
public class ListDataBindEventArgs : EventArgs
public ref class ListDataBindEventArgs : public EventArgs
public class ListDataBindEventArgs extends EventArgs
public class ListDataBindEventArgs extends EventArgs

Exemple

L'exemple de code suivant montre comment utiliser l'événement ItemDataBind pour obtenir les totaux initiaux des paramètres d'état pour la liste. Ce code est extrait d'un exemple plus complet fourni pour la vue d'ensemble de List.

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
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    If Not IsPostBack Then
        ' Set the DataMembers of the List
        List1.DataValueField = "Status"
        List1.DataTextField = "TaskName"

        ' Create an ArrayList of task data
        Dim arr As ArrayList = New ArrayList()
        arr.Add(New Task("Define transactions", "scheduled"))
        arr.Add(New Task("Verify transactions", "scheduled"))
        arr.Add(New Task("Check balance sheet", "scheduled"))
        arr.Add(New Task("Compile balance sheet", "scheduled"))
        arr.Add(New Task("Prepare report", "scheduled"))
        arr.Add(New Task("Send report", "scheduled"))
        
        ' Bind the array to the list
        List1.DataSource = arr
        List1.DataBind()

        Const spec As String = "Start: {0} tasks are done, {1} " & _
           "tasks are scheduled, and {2} tasks are pending."
        Label2.Text = String.Format(spec, doneCount, _
            schedCount, pendCount)

        List1.Decoration = ListDecoration.Bulleted
    End If
End Sub

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

Sécurité .NET Framework

  • AspNetHostingPermission  pour opérer dans un environnement hébergé. Valeur de demande : LinkDemand ; valeur d'autorisation : Minimal
  • AspNetHostingPermission  pour opérer dans un environnement hébergé. Valeur de demande : InheritanceDemand ; valeur d'autorisation : Minimal

Hiérarchie d'héritage

System.Object
   System.EventArgs
    System.Web.UI.MobileControls.ListDataBindEventArgs

Sécurité des threads

Les membres statiques publics (Shared en Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Plates-formes

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.

Informations de version

.NET Framework

Prise en charge dans : 2.0, 1.1

Voir aussi

Référence

Membres ListDataBindEventArgs
System.Web.UI.MobileControls, espace de noms
List, classe

Autres ressources

Introduction au contrôle List