Compartilhar via


IParametersInProvider.ParametersInConsumerInit method

NOTE: This API is now obsolete.

Fornece um manipulador de eventos para um provedor de Web Part para processar o evento de ParametersInConsumerInit de um Web Part que implementa a interface IParametersInConsumer do consumidor.

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

Syntax

'Declaração
<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
    Type: System.Object

    Uma Web Part que implementa a interface IParametersInConsumer .

Examples

O exemplo de código a seguir mostra a implementação de um manipulador de eventos ParametersInConsumerInit . Este exemplo de código é parte de um exemplo maior fornecido para a interface 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;
        }
    }
}

Ver também

Referência

IParametersInProvider interface

IParametersInProvider members

Microsoft.SharePoint.WebPartPages.Communication namespace