Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IFilterConsumer.FilterConsumerInit event

NOTE: This API is now obsolete.

The initialization event for receiving the list of fields, and optionally field display names used to filter a list.

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

[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event FilterConsumerInitEventHandler FilterConsumerInit

The following code example shows an overridden PartCommunicationInitmethod that fires the FilterConsumerInit event. This code example is part of a larger example provided for the IFilterConsumer 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()
{
    // If the connection wasn't actually formed then don't want to send 
    // Init event.
    if(_connected)
    {
        // Ensure that all of the Web Part's controls are created.
        // The _filterFieldNames and _filterFieldDisplayNames are set 
        // during EnsureChildControls()
        EnsureChildControls();

        // If there is a listener, fire the FilterConsumerInit event.
        if (FilterConsumerInit != null)
        {
            // Create the FilterConsumerInitEventArgs object for the 
            // FilterConsumerInit event.
            FilterConsumerInitEventArgs filterConsumerInitArgs = new FilterConsumerInitEventArgs();
            
            // Set the field names.
            filterConsumerInitArgs.FieldList = _filterFieldNames;
            filterConsumerInitArgs.FieldDisplayList = _filterFieldDisplayNames;
            
            // Fire the FilterConsumerInit event.
            FilterConsumerInit(this, filterConsumerInitArgs);
        }
    }
}

Show:
© 2015 Microsoft