IListProvider.ListProviderInit Event

NOTE: This API is now obsolete.

Occurs as the initialization event that provides a list of the field names of data and an optional list of field display names to a Web Part that implements the IListConsumer interface.

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

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

The following code example overrides the PartCommunicationInit method and fires the ListProviderInit event. This code example is part of a larger example provided for the IListProvider interface.

// 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.

    // Check 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);