Share via


ICellProvider Interface

The ICellProvider interface enables a Web Part to communicate with a Web Part that implements the ICellConsumer interface to work with a single value item.

Events

The following table shows the events of the ICellProvider interface and a brief description of each.

Name Description
CellProviderInit Initialization event.
CellReady Sent when a cell changes, such as when a cell is selected or updated.

Note  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.

Public Methods

The following table shows the methods of the ICellProvider interface and a brief description of each.

Name Description
CellConsumerInit(object, Microsoft.SharePoint.WebPartPages.Communication.CellConsumerInitEventArgs) Initialization event handler. This event handler is of type CellConsumerInitEventHandler.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

The ICellProvider interface should be used with Web Parts that need to pass a single value to an ICellConsumer Web Part. It can be used in scenarios where the consumer Web Part was written to handle the type of data being passed by the provider Web Part. The ICellProvider interface supports the ability to send and receive initialization arguments, which allows an ICellProvider Web Part to dynamically change its user interface to better fit the needs of the consumer part. An ICellProvider interface can be connected only to an ICellConsumer interface. When connecting an ICellProvider Web Part to an ICellConsumer Web Part, a direct connection must be used so no transformer dialog box will be displayed.

Example

The following code example shows a Web Part class that implements the ICellProvider interface and supports running its connections code only on the server (ConnectionRunAt.Server). This Web Part can be connected to one or more Web Parts which implement the ICellConsumer interface on the server. This Web Part's user interface displays a simple text box and button. When the button is clicked, the Web Part passes the "cell" value in its text box to all other Web Parts which are connected to it.

There are 10 steps specific to making this Web Part class a connectable Web Part. These steps are numbered and commented in the code example.

The following code example shows a Web Part class that implements the ICellProvider interface and supports running its connections code only on the client (ConnectionRunAt.Client). This Web Part can be connected to one or more Web Parts which implement the ICellConsumer interface on the client. This Web Part's user interface displays a simple text box and button. When the button is clicked, the Web Part passes the "cell" value in its text box to all other Web Parts which are connected to it.

There are 11 steps specific to making this Web Part class a connectable Web Part. These steps are numbered and commented in the code example.

For an overview of the steps of creating a connectable Web Part, see Creating a Connectable Web Part.

Requirements

Namespace: Microsoft.SharePoint.WebPartPages.Communication

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security