IParametersOutProvider.ParametersOutReady Event

NOTE: This API is now obsolete.

Occurs when the parameter list is ready to be sent to the consumer Web Part from a provider Web Part that implements the IParametersOutProvider interface. On the client computer, it can occur any time; however, it is typically raised when a parameter is updated or selected. On the server, it should be raised in the WebPart.PartCommunicationMainmethod.

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

Syntax

<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event ParametersOutReady As ParametersOutReadyEventHandler

Dim instance As IParametersOutProvider
Dim handler As ParametersOutReadyEventHandler

AddHandler instance.ParametersOutReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event ParametersOutReadyEventHandler ParametersOutReady

Remarks

The event handler receives an argument of type Microsoft.SharePoint.WebPartPages.Communication.ParametersOutReadyEventArgs containing data related to this event. This class provides an array of strings in its ParameterValues property. Each string in the array is a value of a parameter. The number and order of parameters contained in this array must match those specified by the Microsoft.SharePoint.WebPartPages.Communication.ParametersOutProviderInitEventArgs argument of the ParametersOutProviderInit method.

A Web Part that implements the IParametersOutProvider interface should always raise either the ParametersOutReady or the NoParametersOut event. Some Web Parts may not behave properly if they do not receive this information. Raise the ParametersOutReady event to send the parameters. Raise the NoParametersOut event to indicate that there is no change in the parameters.

Examples

The following code example shows an overridden PartCommunicationsMain method that fires the ParametersOutReady event. This code example is part of a larger example provided for the IParametersOutProvider interface.

      ' Step #8: Override the PartCommunicationMain() method.
      ' The PartCommunicationMain method is called by the Web Part 
      ' infrastructure on the client during the ASP.NET PreRender
      ' event to allow the part to pass its primary data to the other 
      ' connected parts.
      ' It is important to always fire either the ParametersOutReady or 
      ' the NoParametersOut event. Some parts
      ' may not behave properly if they are left waiting for this 
      ' information. ParametersOutReady should be fired to send the 
      ' parameters. NoParametersOut should be fired to indicate that 
      ' there is no change in the parameters.
       Public Overrides Sub PartCommunicationMain()
            ' Ensure that all of the Web Part's controls are created.
            EnsureChildControls()

            ' Check if connected.
            If _connected Then
                ' Need to create the ParametersOutReadyEventArgs object 
                ' for the ParametersOutReady event.
                Dim parametersOutReadyEventArgs As New ParametersOutReadyEventArgs()

                If _parametersReadyButtonClicked Then 'ParametersOutReady Button was clicked
                    ' Set the values to the values of the text boxes.
                    parametersOutReadyEventArgs.ParameterValues = New String(3) {}
                    parametersOutReadyEventArgs.ParameterValues(0) = _fontFamilyListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(1) = _fontColorListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(2) = _fontWeightListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(3) = _fontSizeListBox.SelectedItem.Value

                    ' Fire the ParametersOutReady event.
                    RaiseEvent ParametersOutReady(Me, parametersOutReadyEventArgs)
                    _parametersReadyButtonClicked = False
                    'The NoParametersOut button was clicked.
                ElseIf _noParametersOutButtonClicked Then
                    ' Fire the event.
                    RaiseEvent NoParametersOut(Me, New EventArgs())
                    _noParametersOutButtonClicked = False
                    ' The user didn't click any button.
                Else
                    ' Fire the event.
                    RaiseEvent NoParametersOut(Me, New EventArgs())
                    _noParametersOutButtonClicked = False
                End If
            End If
        End Sub  
// Step #8: Override the PartCommunicationMain() method.
// The PartCommunicationMain method is called by the Web Part 
// infrastructure on the client during the ASP.NET PreRender
// event to allow the part to pass its primary data to the other 
// connected parts. It is important to always fire either the 
// ParametersOutReady or the NoParametersOut event. Some parts
// may not behave properly if they are left waiting for this 
// information. ParametersOutReady should be fired to send the 
// parameters. NoParametersOut should be fired to indicate that there 
// is no change in the parameters.

public override void PartCommunicationMain()
{
    // Ensure that all of the Web Part's controls are created.
    EnsureChildControls();

    // Check if connected.
    if(_connected)
    {
        // If there is a listener, fire the ParametersOutReady event.
        if(ParametersOutReady != null)
        {
            // Need to create the ParametersOutReadyEventArgs object 
            // for the ParametersOutReady event.
            ParametersOutReadyEventArgs parametersOutReadyEventArgs = new ParametersOutReadyEventArgs();

            if(_parametersReadyButtonClicked) //ParametersOutReady Button was clicked
            {
                // If there is a listener, fire the ParametersOutReady 
                // event.
                if(ParametersOutReady != null)
                {
                    // Set the values to the values of the text
                    // boxes.
                    parametersOutReadyEventArgs.ParameterValues = new string[4];
                    parametersOutReadyEventArgs.ParameterValues[0] = _fontFamilyListBox.SelectedItem.Value;
                    parametersOutReadyEventArgs.ParameterValues[1] = _fontColorListBox.SelectedItem.Value;
                    parametersOutReadyEventArgs.ParameterValues[2] = _fontWeightListBox.SelectedItem.Value;
                    parametersOutReadyEventArgs.ParameterValues[3] = _fontSizeListBox.SelectedItem.Value;

                    // Fire the ParametersOutReady event.
                    ParametersOutReady(this, parametersOutReadyEventArgs);

                    _parametersReadyButtonClicked = false;
                }
            }
            //The NoParametersOut button was clicked.
            else if(_noParametersOutButtonClicked) 
            {
                // If there is a listener, fire the NoParametersOut 
                // event.
                if(NoParametersOut != null)
                {
                    // Fire the event.
                    NoParametersOut(this, new EventArgs());

                    _noParametersOutButtonClicked = false;
                }
            }
            // The user didn't click any button.
            else 
            {
                // If there is a listener, fire the NoParametersOut 
                // event.
                if(NoParametersOut != null)
                {
                    // Fire the event.
                    NoParametersOut(this, new EventArgs());

                    _noParametersOutButtonClicked = false;
                }
            }
        }
    }
}

See Also

Reference

IParametersOutProvider Interface

IParametersOutProvider Members

Microsoft.SharePoint.WebPartPages.Communication Namespace