Freigeben über


ListReadyEventArgs-Klasse

HINWEIS: Diese API ist veraltet.

Enthält eine Liste der Daten an das Ereignis ListReadyder IListProvider-Schnittstelle.

Vererbungshierarchie

System.Object
  System.EventArgs
    Microsoft.SharePoint.WebPartPages.Communication.ListReadyEventArgs

Namespace:  Microsoft.SharePoint.WebPartPages.Communication
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartTable instead")> _
Public Class ListReadyEventArgs _
    Inherits EventArgs
'Usage
Dim instance As ListReadyEventArgs
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartTable instead")]
public class ListReadyEventArgs : EventArgs

Beispiele

Das folgende Codebeispiel zeigt eine überschriebene WebPart.PartCommunicationMain-Methode, die erstellt eine Instanz der Klasse ListReadyEventArgs zu senden, wenn das ListReady -Ereignis tritt auf. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IListProvider -Schnittstelle.

' Step #8: Override the PartCommunicationMain method.
' The PartCommunicationMain method is called by the Web Part 
' Infrastructure on the client during the ASP.NET PreRender
' event to allow the part to pass its primary data to the other 
' connected parts.
' It is important to always fire the ListReady or PartialListReady 
' event. Some parts may not behave properly if they are left waiting 
' for this information.
Public Overrides Sub PartCommunicationMain()
   ' Ensure that all of the Web Part's controls are created.
   

   ' Ensure that all of the Web Part's controls are created.
   EnsureChildControls()
   
   ' Check if connected
   If _connected Then
      ' If there is a listener, fire the ListReady event.
      If Not (ListReady Is Nothing) Then
         ' Create the ListReadyEventArgs object for the ListProviderInit event.
         Dim listReadyArgs As New ListReadyEventArgs()
         
         ' If user clicked button, send the value.
         If _listButtonClicked Then
            ' Set the List to the value of the table in the DataGrid.
            ' This is the value that will be sent to the consumer Web 
            ' Part.
            listReadyArgs.List = CType(_dataGrid.DataSource, DataTable)
         Else
            ' The user didn't click the button, so send a
            ' null DataTable to the consumer Web Part.
            listReadyArgs.List = Nothing
         End If
         
         ' Fire the ListReady event.
         ' The consumer Web Part will receive the DataTable.
         
         ListReady(Me, listReadyArgs)

      End If
   End If
End Sub 'PartCommunicationMain
// Step #8: Override the PartCommunicationMain method.
// The PartCommunicationMain method is called by the Web Part 
// Infrastructure on the client during the ASP.NET PreRender
// event to allow the part to pass its primary data to the other 
// connected parts.
// It is important to always fire the ListReady or PartialListReady 
// event. Some parts may not behave properly if they are left waiting 
// for this information.
public override void PartCommunicationMain()
{
    // Ensure that all of the Web Part's controls are created.
    EnsureChildControls();

    // Check if connected
    if(_connected)
    {
        // If there is a listener, fire the ListReady event.
        if (ListReady != null)
        {
            // Create the ListReadyEventArgs object for the 
            // ListProviderInit event.
            ListReadyEventArgs listReadyArgs = new ListReadyEventArgs();

            // If user clicked button, send the value.
            if (_listButtonClicked)
            {
                // Set the List to the value of the table in the 
                // DataGrid.
                // This is the value that will be sent to the consumer 
                // Web Part.
                listReadyArgs.List = ((DataTable)_dataGrid.DataSource);
            }
            else
            {
                // The user didn't click the button, so send a
                // null DataTable to the consumer Web Part.
                listReadyArgs.List = null;
            }

            // Fire the ListReady event.
            // The consumer Web Part will receive the DataTable.
            ListReady(this, listReadyArgs);
        }
    }
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.

Siehe auch

Referenz

ListReadyEventArgs-Member

Microsoft.SharePoint.WebPartPages.Communication-Namespace