Evento IParametersOutProvider.ParametersOutReady

NOTA: esta API está ahora obsoleta.

Se produce cuando la lista de parámetros está lista para enviarse para el elemento Web de consumidor desde un proveedor de elemento Web que implementa la interfaz IParametersOutProvider . En el equipo cliente, se puede producir cualquier momento; Sin embargo, normalmente se produce cuando se actualiza o se selecciona un parámetro. En el servidor, debe producirse en el método deWebPart.PartCommunicationMain.

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")> _
Event ParametersOutReady As ParametersOutReadyEventHandler
'Uso
Dim instance As IParametersOutProvider
Dim handler As ParametersOutReadyEventHandler

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

Comentarios

El controlador de eventos recibe un argumento de tipo Microsoft.SharePoint.WebPartPages.Communication.ParametersOutReadyEventArgs que contiene los datos relacionados con este evento. Esta clase proporciona una matriz de cadenas en su propiedad ParameterValues . Cada cadena de la matriz es un valor de un parámetro. El número y el orden de los parámetros contenidos en esta matriz deben coincidir con los especificados por el argumento de Microsoft.SharePoint.WebPartPages.Communication.ParametersOutProviderInitEventArgs del método ParametersOutProviderInit .

Un elemento Web que implementa la interfaz IParametersOutProvider siempre deben provocar el ParametersOutReady o el evento NoParametersOut . Es posible que algunos elementos Web no funcione correctamente si no reciben esta información. Desencadenar el evento ParametersOutReady para enviar los parámetros. Desencadenar el evento NoParametersOut para indicar que no hay ningún cambio en los parámetros.

Ejemplos

En el ejemplo de código siguiente se muestra un método invalidado PartCommunicationsMain que se desencadena el evento ParametersOutReady . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz IParametersOutProvider .

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

Vea también

Referencia

interfaz IParametersOutProvider

Miembros IParametersOutProvider

Espacio de nombres Microsoft.SharePoint.WebPartPages.Communication