Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

WebPart.GetInitEventArgs method

NOTE: This API is now obsolete.

Returns the InitEventArgs object for the name of the interface that is passed in.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
public virtual InitEventArgs GetInitEventArgs(
	string InterfaceName
)

Parameters

InterfaceName
Type: System.String

An interface in the Microsoft.SharePoint.WebPartPages.Communication namespace that uses a transformer.

Return value

Type: Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
An InitEventArgs object such as a CellProviderInitEventArgs object returned by a Web Part that implements the ICellProvider interface.

The GetInitEventArgs method is only required for the interfaces of the Microsoft.SharePoint.WebPartPages.Communication namespace that can use transformers, such as the IRowProvider, ICellConsumer, IFilterConsumer, IParametersOutProvider, and IParametersInConsumer interfaces. The InitEventArgs method is called by the Web-based connection authoring user interface for all the initial data required for creating a connection that involves a transformer. It is a virtual method on the WebPart that must be overridden by the developer for the interfaces that use transformers. If it is not overridden, an error message is displayed.

The following code example shows an overridden GetInitEventArgs method. This code example is part of a larger example provided for the ICellConsumer interface.

For an overview of the steps of creating a connectable Web Part, see Creating a Connectable Web Part.

// Step #11: Override the GetInitEventArgs() method.
// The GetInitEventArgs method is called by the Web Part infrastructure during the ASP.NET PreRender event  
// to gather the necessary information it needs to build the transformer dialog box. The transformer dialog box
// is needed when connecting different interfaces such as IRowProvider
// to ICellConsumer. The transformer dialog box allows the user to map the fields between the 
// interfaces. The GetInitEventArgs method only needs to be implemented for interfaces that
// can participate in a transformer which are the following:
// ICellConsumer, IRowProvider, IFilterConsumer, IParametersOutProvider, IParametersInConsumer.
// <param name="interfacename">Name of interface on which the Web Part infrastructure is requesting information</param>
// <returns>An InitEventArgs object</returns>
public override InitEventArgs GetInitEventArgs(string interfaceName)
{
    // Check if this is my particular cell interface.
    if (interfaceName == "MyCellConsumerInterface")
    {
        // Create the object that will return the initialization arguments.
        CellConsumerInitEventArgs cellConsumerInitArgs = new CellConsumerInitEventArgs();

        // Set the FieldName and FieldDisplay name values.
        cellConsumerInitArgs.FieldName = _cellName;
        cellConsumerInitArgs.FieldDisplayName = _cellDisplayName;

        // Return the CellConsumerInitEventArgs object.
        return(cellConsumerInitArgs);
    }
    else
    {
        return(null);
    }
}

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.