Evento IParametersInProvider.ParametersInReady

NOTA: esta API está ahora obsoleta.

Se produce cuando la lista de parámetros está lista para enviarse al elemento Web consumidor. En el equipo cliente, puede producirse en cualquier momento; Sin embargo, normalmente se produce cuando se actualiza o se selecciona un parámetro. En el servidor, debe elevarse en el método 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 ParametersInReady As ParametersInReadyEventHandler
'Uso
Dim instance As IParametersInProvider
Dim handler As ParametersInReadyEventHandler

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

Comentarios

El controlador de eventos recibe un argumento de tipo Microsoft.SharePoint.WebPartPages.Communication.ParametersInReadyEventArgs que contiene los datos relacionados con este evento. ParametersInReadyEventArgs contiene 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 que se representan en esta matriz deben coincidir con los especificados por el argumento de Microsoft.SharePoint.WebPartPages.Communication.ParametersInConsumerInitEventArgs en el método ParametersInConsumerInit .

Un elemento Web que implementa la interfaz IParametersInProvider siempre deben provocar el evento ParametersInReady o el evento NoParametersIn . Es posible que algunos elementos Web no funcione correctamente si no reciben esta información. Desencadenar el evento ParametersInReady para enviar los parámetros. Desencadenar el evento NoParametersIn 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 PartCommunicationMain que se desencadena el evento ParametersInReady . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz IParametersInProvider .

      ' Step #7: Implement 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 ParametersInReady or 
      ' the NoParametersIn event. Some parts
      ' may not behave properly if they are left waiting for this 
      ' information.
      ' ParametersInReady should be fired to send the parameters.
      ' NoParametersIn 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
                ' Create the ParametersInReadyEventArgs object for the ParametersInReady event.
                Dim parametersInReadyEventArgs As New ParametersInReadyEventArgs()

                If _parametersReadyButtonClicked Then 'ParametersInReady Button was clicked

                    ' Set the parameter values to the text box values.
                    If Not (_fieldList Is Nothing) Then
                        parametersInReadyEventArgs.ParameterValues = New String(_fieldList.Length) {}

                        Dim index As Integer
                        For index = 0 To _fieldList.Length - 1
                            parametersInReadyEventArgs.ParameterValues(index) = _fontAttributeTextBox(index).Text
                        Next index

                        ' Fire the ParametersInReady event.
                        RaiseEvent ParametersInReady(Me, parametersInReadyEventArgs)
                        '_fieldList is null
                    Else
                        ' Fire the event.
                        RaiseEvent NoParametersIn(Me, New EventArgs())
                    End If
                    _parametersReadyButtonClicked = False
                ElseIf _noParametersInButtonClicked Then 'NoParametersIn Button was clicked                       
                    ' Fire the NoParametersIn event.
                    RaiseEvent NoParametersIn(Me, New EventArgs())
                    _noParametersInButtonClicked = False
                End If
            End If
        End Sub
// Step #7: Implement the PartCommunicationMain() method.
// The PartCommunicationMain method is called by the Web Part 
// infrastructure on the client during the ASP.NET PreRender
// phase to allow the part to pass its primary data to the other 
// connected parts.
// It is important to always fire either the ParametersInReady or the 
// NoParametersIn event. Some parts
// may not behave properly if they are left waiting for this 
// information.
// ParametersInReady should be fired to send the parameters.
// NoParametersIn 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 ParametersInReady event.
        if(ParametersInReady != null)
        {
            // Create the ParametersInReadyEventArgs object for the 
            // ParametersInReady event.
            ParametersInReadyEventArgs parametersInReadyEventArgs = new ParametersInReadyEventArgs();

            // If the ParametersInReady button was clicked.
            if(_parametersReadyButtonClicked)
            {
                // If there is a listener, fire the ParametersInReady 
                // event.
                if(ParametersInReady != null)
                {
                    // Set the parameter values to the text box values.
                    if (_fieldList != null)
                        parametersInReadyEventArgs.ParameterValues = new string[_fieldList.Length];

                    for (int index = 0; index < _fieldList.Length; index++)
                    {
                        parametersInReadyEventArgs.ParameterValues[index] = _fontAttributeTextBox[index].Text;
                    }

                    // Fire the ParametersInReady event.
                    ParametersInReady(this, parametersInReadyEventArgs);

                    _parametersReadyButtonClicked = false;
                }
            }

            // If the NoParametersIn button was clicked.
            else if(_noParametersInButtonClicked)
            {
                // If there is a listener, fire the NoParametersIn 
                // event.
                if(NoParametersIn != null)
                {
                    // Fire the event.
                    NoParametersIn(this, new EventArgs());

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

                    _noParametersInButtonClicked = false;
                }
            }
        }
    }
}

Vea también

Referencia

interfaz IParametersInProvider

Miembros IParametersInProvider

Espacio de nombres Microsoft.SharePoint.WebPartPages.Communication