Freigeben über


IListProvider.ListProviderInit-Ereignis

HINWEIS: Diese API ist veraltet.

Tritt auf, wie die Initialisierungsereignis, das eine Liste von Feldnamen der Daten und einer optionalen Liste mit Anzeigenamen von Feldern mit einem Webpart bereitstellt, die die IListConsumer -Schnittstelle implementiert wird.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartTable instead")> _
Event ListProviderInit As ListProviderInitEventHandler
'Usage
Dim instance As IListProvider
Dim handler As ListProviderInitEventHandler

AddHandler instance.ListProviderInit, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartTable instead")]
event ListProviderInitEventHandler ListProviderInit

Beispiele

Im folgenden Codebeispiel wird überschreibt die PartCommunicationInit -Methode und löst das ListProviderInit -Ereignis. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IListProvider -Schnittstelle.

       ' Step #7: Override PartCommunicationInit method.
       ' PartCommunicationInit() is called by the Web Part 
       ' infrastructure during the ASP.NET PreRender 
       ' event to allow the part to pass initialization information to 
       ' the other connected parts.
       ' It is important to always pass initialization information. 
       ' Some parts may not behave properly if this initialization 
       ' information is not received.
       Public Overrides Sub PartCommunicationInit()
            ' Ensure that all of the Web Part's controls are created.
            EnsureChildControls()

            ' Check if connected.
            If _connected Then
                ' Create the ListProviderInitEventArgs object for the 
                ' ListProviderInit event.
                Dim listProviderInitArgs As New ListProviderInitEventArgs()

                ' Set the list field names.
                listProviderInitArgs.FieldList = _listFieldNames
                listProviderInitArgs.FieldDisplayList = _listFieldDisplayNames

                ' Fire the ListProviderInit event.
                RaiseEvent ListProviderInit(Me, listProviderInitArgs)
            End If
        End Sub 
// Step #7: Override PartCommunicationInit method.
// PartCommunicationInit() is called by the Web Part infrastructure 
// during the ASP.NET PreRender event to allow the part to pass 
// initialization information to the other connected parts.
// It is important to always pass initialization information. Some 
// parts may not behave properly if this initialization information is 
// not received.

public override void PartCommunicationInit()
{
    // Ensure that all of the Web Part's controls are created.
    EnsureChildControls();

    // Check if connected.
    if(_connected)
    {
        // If there is a listener, fire ListProviderInit event.
        if (ListProviderInit != null)
        {
            // Create the ListProviderInitEventArgs object for the 
            // ListProviderInit event.
            ListProviderInitEventArgs listProviderInitArgs = new ListProviderInitEventArgs();
            
            // Set the list field names.
            listProviderInitArgs.FieldList = _listFieldNames;
            listProviderInitArgs.FieldDisplayList = _listFieldDisplayNames;

            // Fire the ListProviderInit event.
            ListProviderInit(this, listProviderInitArgs);
        }
    }
}

Siehe auch

Referenz

IListProvider Schnittstelle

IListProvider-Member

Microsoft.SharePoint.WebPartPages.Communication-Namespace