Evento ICellProvider.CellReady

NOTA: esta API está ahora obsoleta.

Se produce cuando cambia una celda, como cuando se selecciona o se actualiza una celda.

Espacio de nombres:  Microsoft.SharePoint.WebPartPages.Communication
Ensamblado:  Microsoft.SharePoint (en Microsoft.SharePoint.dll)

Sintaxis

'Declaración
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")> _
Event CellReady As CellReadyEventHandler
'Uso
Dim instance As ICellProvider
Dim handler As CellReadyEventHandler

AddHandler instance.CellReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")]
event CellReadyEventHandler CellReady

Comentarios

El evento CellReady también debe usarse para enviar el valor inicial de la celda si es necesario. El evento CellReady se produce cada vez que se ejecuta el controlador de eventos PartCommunicationMain . Para las conexiones de cliente, el evento de CellReady puede producirse en cualquier momento después de ejecutar PartCommunicationMain .

Ejemplos

En el ejemplo de código siguiente se muestra un método invalidado PartCommunicationMain que crea una estructura de datos CellReadyEventArgs para contener el valor de la celda proporcionada, se establece el valor de la celda y, a continuación, se desencadena el evento CellReady . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz ICellProvider .

      ' Step #10: 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 the CellReady event. Some parts
      ' may not behave properly if they are left waiting for this 
      ' information.
      Public Overrides Sub PartCommunicationMain()
            ' Check if connected.
            If _connected Then
                ' Create the CellReadyEventArgs data structure for the 
                ' CellProviderInit event.
                Dim cellReadyArgs As New CellReadyEventArgs()

                ' If the user clicked the button, then send the value.
                If _cellClicked Then
                    ' Set the cell to the value of the TextBox text
                    ' This is the value that will be sent to the 
                    ' Consumer
                    cellReadyArgs.Cell = _cellInput.Text
                Else
                    ' The user didn't actually click the button
                    ' so just send an empty string to the consumer.
                    cellReadyArgs.Cell = ""
                End If

                ' Fire the CellReady event.
                ' The Consumer will receive the cell value in its 
                ' CellReady event handler
                RaiseEvent CellReady(Me, cellReadyArgs)
            End If
        End Sub
// Step #10: 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 the CellReady event. Some parts
// may not behave properly if they are left waiting for this 
// information.
public override void PartCommunicationMain()
{
    // Check if connected.
    if(_connected)
    {
        // If there is a listener, fire the CellReady event.
        if (CellReady != null)
        {
            // Create the CellReadyEventArgs data structure for the 
            // CellProviderInit event.
            CellReadyEventArgs cellReadyArgs = new 
               CellReadyEventArgs();

            // If the user clicked the button, then send the value.
            if (_cellClicked)
            {
                // Set the cell to the value of the TextBox text.
                // This is the value that will be sent to the Consumer
                cellReadyArgs.Cell = _cellInput.Text;
            }
            else
            {
                // The user didn't actually click the button
                // so just send an empty string to the consumer.
                cellReadyArgs.Cell = "";
            }

            // Fire the CellReady event.
            // The Consumer will receive the cell value in its 
            // CellReady event handler
            CellReady(this, cellReadyArgs);
        }
    }
}

Vea también

Referencia

interfaz ICellProvider

Miembros ICellProvider

Espacio de nombres Microsoft.SharePoint.WebPartPages.Communication