Partager via


CellReadyEventArgs - Classe

Remarque : cette API est désormais obsolète.

Fournit la valeur de la cellule en cours à partir d'un composant WebPart qui implémente l'interface ICellProvider lorsque l'événement CellReady se produit.

Hiérarchie d’héritage

System.Object
  System.EventArgs
    Microsoft.SharePoint.WebPartPages.Communication.CellReadyEventArgs

Espace de noms :  Microsoft.SharePoint.WebPartPages.Communication
Assembly :  Microsoft.SharePoint (dans Microsoft.SharePoint.dll)

Syntaxe

'Déclaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")> _
Public Class CellReadyEventArgs _
    Inherits EventArgs
'Utilisation
Dim instance As CellReadyEventArgs
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")]
public class CellReadyEventArgs : EventArgs

Exemples

L'exemple de code suivant montre une méthode desubstitué WebPart.PartCommunicationMainqui crée une structure de données CellReadyEventArgs pour contenir la valeur de la propriété Cell , définit la valeur de la propriété, puis déclenche l'événement CellReady . Cet exemple de code fait partie d'un exemple plus développé fourni pour l'interface 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
      ' If there is a listener, fire the CellReady event.
      If Not (CellReady Is Nothing) 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 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);
                }
            }
        }

Cohérence de thread

Tous les membres statique (Partagé dans Visual Basic)s publics de ce type sont thread-safe. Cela n’est pas garanti pour les membres d’instance.

Voir aussi

Référence

CellReadyEventArgs - Membres

Microsoft.SharePoint.WebPartPages.Communication - Espace de noms