Compartir a través de


del método IParametersInProvider.ParametersInConsumerInit

NOTA: esta API está ahora obsoleta.

Proporciona un controlador de eventos para un proveedor de elemento Web para procesar el evento ParametersInConsumerInit de un elemento Web que implementa la interfaz IParametersInConsumer del consumidor.

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

Sintaxis

'Declaración
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Sub ParametersInConsumerInit ( _
    sender As Object, _
    parametersInConsumerInitEventArgs As ParametersInConsumerInitEventArgs _
)
'Uso
Dim instance As IParametersInProvider
Dim sender As Object
Dim parametersInConsumerInitEventArgs As ParametersInConsumerInitEventArgs

instance.ParametersInConsumerInit(sender, _
    parametersInConsumerInitEventArgs)
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
void ParametersInConsumerInit(
    Object sender,
    ParametersInConsumerInitEventArgs parametersInConsumerInitEventArgs
)

Parámetros

  • sender
    Tipo: System.Object

    Un elemento Web que implementa la interfaz IParametersInConsumer .

Ejemplos

En el ejemplo de código siguiente se muestra la implementación de un controlador de eventos ParametersInConsumerInit . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz IParametersInProvider .

      ' Step #8: Implement the ParametersInConsumerInit event handler.
      ' The connected consumer part will call this method during its 
      ' PartCommunicationInit phase
      ' to pass initialization information to the provider Web Part. 
      ' The parameters names from the
      ' consumer Web Part are passed in. In this example, these values 
      ' are used to dynamically 
      ' generate the input text boxes in the provider Web Part.
      ' <param name="sender">Consumer Web Part</param>
      ' <param name="parametersInConsumerInitEventArgs">The args passed 
      ' by the Consumer</param>
      Public Sub ParametersInConsumerInit(sender As Object, parametersInConsumerInitEventArgs As ParametersInConsumerInitEventArgs) _
             Implements IParametersInProvider.ParametersInConsumerInit
         ' Initialize field lists.
         Dim paramProps As ParameterInProperty() = parametersInConsumerInitEventArgs.ParameterInProperties
         
         If Not (paramProps Is Nothing) Then
            _fieldList = New String(paramProps.Length-1) {}
            _fieldDisplayList = New String(paramProps.Length-1) {}
            _requiredFieldFlag = New Boolean(paramProps.Length-1) {}
            
            ' Populate field lists.
            Dim index As Integer
            For index = 0 To paramProps.Length - 1
               _fieldList(index) = paramProps(index).ParameterName
               _fieldDisplayList(index) = paramProps(index).ParameterDisplayName
               _requiredFieldFlag(index) = paramProps(index).Required
            Next index
         End If
      End Sub 'ParametersInConsumerInit
// Step #8: Implement the ParametersInConsumerInit event handler.
// The connected consumer part will call this method during its 
// PartCommunicationInit phase
// to pass initialization information to the provider Web Part. The 
// parameters names from the
// consumer Web Part are passed in. In this example, these values are 
// used to dynamically 
// generated the input text boxes in the provider Web Part.
// <param name="sender">Consumer Web Part</param>
// <param name="parametersInConsumerInitEventArgs">The args passed by the Consumer</param>
public void ParametersInConsumerInit(object sender, ParametersInConsumerInitEventArgs parametersInConsumerInitEventArgs)
{
    // Initialize field lists.
    ParameterInProperty[] paramProps = parametersInConsumerInitEventArgs.ParameterInProperties;

    if (paramProps != null)
    {
        _fieldList = new string[paramProps.Length];
        _fieldDisplayList = new string[paramProps.Length];
        _requiredFieldFlag = new bool[paramProps.Length];

        // Populate field lists.
        for (int index = 0; index < paramProps.Length; index++)
        {
            _fieldList[index] = paramProps[index].ParameterName;
            _fieldDisplayList[index] = paramProps[index].ParameterDisplayName;
            _requiredFieldFlag[index] = paramProps[index].Required;
        }
    }
}

Vea también

Referencia

interfaz IParametersInProvider

Miembros IParametersInProvider

Espacio de nombres Microsoft.SharePoint.WebPartPages.Communication