Compartilhar via


WebPart.GetInitEventArgs method

NOTE: This API is now obsolete.

Retorna o objeto InitEventArgs para o nome da interface que é passado.

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

Syntax

'Declaração
<ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")> _
Public Overridable Function GetInitEventArgs ( _
    InterfaceName As String _
) As InitEventArgs
'Uso
Dim instance As WebPart
Dim InterfaceName As String
Dim returnValue As InitEventArgs

returnValue = instance.GetInitEventArgs(InterfaceName)
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
public virtual InitEventArgs GetInitEventArgs(
    string InterfaceName
)

Parâmetros

Valor retornado

Type: Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
Um objeto de InitEventArgs como um objeto CellProviderInitEventArgs retornado por uma Web Part que implementa a interface ICellProvider .

Comentários

O método GetInitEventArgs só é necessário para as interfaces do namespace Microsoft.SharePoint.WebPartPages.Communication que pode usar transformadores, como as interfaces IRowProvider, ICellConsumer, IFilterConsumer, IParametersOutProvidere IParametersInConsumer . O método InitEventArgs é chamado pela conexão baseado na Web, criação de interface do usuário para todos os dados iniciais exigidas para criar uma conexão que envolve um transformador. É um método virtual no WebPart que devem ser substituídas pelo desenvolvedor para as interfaces que usam transformadores. Se não for substituída, será exibida uma mensagem de erro.

Examples

O exemplo de código a seguir mostra um método substituído GetInitEventArgs . Este exemplo de código é parte de um exemplo maior fornecido para a interface ICellConsumer .

Para obter uma visão geral das etapas de criação de uma Web Part conectável, consulte 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.
' interfacename is the name of interface on which the Web Part infrastructure is requesting 
' information.
' Returns an InitEventArgs object.

Public Overrides Function GetInitEventArgs(interfaceName As String) As InitEventArgs
   ' Check if this is my particular cell interface.
   If interfaceName = "MyCellConsumerInterface" Then
      ' Create the object that will return the initialization arguments.
      Dim cellConsumerInitArgs As New CellConsumerInitEventArgs()

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

      ' Return the CellConsumerInitEventArgs object.
      Return cellConsumerInitArgs
   Else
      Return Nothing
   End If
End Function
// 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);
    }
}

Ver também

Referência

WebPart class

WebPart members

Microsoft.SharePoint.WebPartPages namespace