del método WebPart.GetInitEventArgs

NOTA: esta API está ahora obsoleta.

Devuelve el objeto InitEventArgs para el nombre de la interfaz que se pasa en.

Espacio de nombres:  Microsoft.SharePoint.WebPartPages
Ensamblado:  Microsoft.SharePoint (en Microsoft.SharePoint.dll)

Sintaxis

'Declaración
<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 devuelto

Tipo: Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
Devuelve un objeto de InitEventArgs como un objeto CellProviderInitEventArgs por un elemento Web que implementa la interfaz ICellProvider .

Comentarios

El método GetInitEventArgs solo es necesario para las interfaces del espacio de nombres Microsoft.SharePoint.WebPartPages.Communication que pueden usar los transformadores, como las interfaces IRowProvider, ICellConsumer, IFilterConsumer, IParametersOutProvidery IParametersInConsumer . Se llama al método de InitEventArgs por la conexión basada en Web de interfaz de usuario para todos los datos iniciales necesarios para la creación de una conexión que implica un transformador de creación. Es un método virtual en el WebPart que se debe reemplazar por el programador para las interfaces que usan los transformadores. Si no se reemplaza, se muestra un mensaje de error.

Ejemplos

En el ejemplo de código siguiente se muestra un método invalidado GetInitEventArgs . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz ICellConsumer .

Para obtener información general de los pasos de la creación de un elemento Web conectable, vea 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);
    }
}

Vea también

Referencia

clase WebPart

Miembros WebPart

Espacio de nombres Microsoft.SharePoint.WebPartPages