ICellProvider.CellReady Event

NOTE: This API is now obsolete.

Occurs when a cell changes such as when a cell is selected or updated.

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

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

The CellReady event should also be used to send out the initial value of the cell if appropriate. The CellReady event occurs every time the PartCommunicationMain event handler runs. For client-side connections, the CellReady event can occur anytime after PartCommunicationMain runs.

The following code example shows an overridden PartCommunicationMain method that creates a CellReadyEventArgs data structure to contain the provided cell value, sets the cell value, and then fires the CellReady event. This code example is part of a larger example provided for the ICellProvider interface.

// 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);
        }
    }
}

Show: