IParametersInProvider.ParametersInConsumerInit Method

NOTE: This API is now obsolete.

Provides an event handler for a provider Web Part to process the ParametersInConsumerInit event of a consumer Web Part that implements the IParametersInConsumer interface.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Sub ParametersInConsumerInit ( _
    sender As Object, _
    parametersInConsumerInitEventArgs As ParametersInConsumerInitEventArgs _
)
'Usage
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
)

Parameters

  • sender
    Type: System.Object

    A Web Part that implements the IParametersInConsumer interface.

Examples

The following code example shows the implementation of a ParametersInConsumerInit event handler. This code example is part of a larger example provided for the IParametersInProvider interface.

      ' 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;
        }
    }
}

See Also

Reference

IParametersInProvider Interface

IParametersInProvider Members

Microsoft.SharePoint.WebPartPages.Communication Namespace