Поделиться через


Метод IParametersInProvider.ParametersInConsumerInit

Примечание. Этот API устарел.

Предоставляет обработчик событий для обработки события ParametersInConsumerInit , реализующий интерфейс IParametersInConsumer веб-части потребителя веб-части поставщика.

Пространство имен:  Microsoft.SharePoint.WebPartPages.Communication
Сборка:  Microsoft.SharePoint (в Microsoft.SharePoint.dll)

Синтаксис

'Декларация
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Sub ParametersInConsumerInit ( _
    sender As Object, _
    parametersInConsumerInitEventArgs As ParametersInConsumerInitEventArgs _
)
'Применение
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
)

Параметры

  • sender
    Тип: System.Object

    Веб-часть, которая реализует интерфейс IParametersInConsumer .

Примеры

В следующем примере кода показана реализация обработчика событий ParametersInConsumerInit . Данный пример кода является частью большего примера, приведенного для интерфейса 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;
        }
    }
}

См. также

Справочные материалы

IParametersInProvider интерфейс

Элементы IParametersInProvider

Пространство имен Microsoft.SharePoint.WebPartPages.Communication