Share via


ICellProvider.CellConsumerInit method

NOTE: This API is now obsolete.

An event handler for receiving initialization information passed by the CellConsumerInit event of a connected Web Part that implements the ICellConsumer interface. The delegate for this event handler is CellConsumerInitEventHandler.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")> _
Sub CellConsumerInit ( _
    sender As Object, _
    cellConsumerInitEventArgs As CellConsumerInitEventArgs _
)
'Usage
Dim instance As ICellProvider
Dim sender As Object
Dim cellConsumerInitEventArgs As CellConsumerInitEventArgs

instance.CellConsumerInit(sender, cellConsumerInitEventArgs)
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")]
void CellConsumerInit(
    Object sender,
    CellConsumerInitEventArgs cellConsumerInitEventArgs
)

Parameters

  • sender
    Type: System.Object

    A reference to the consumer Web Part.

Examples

The following code example shows the implementation of a CellConsumerInit method to receive the field display name sent by an ICellConsumer Web Part. This code example is part of a larger example provided for the ICellProvider interface.

Because this example uses the SPEncode class, it requires a using directive (Imports in Visual Basic) for the Microsoft.SharePoint.Utilities namespace.

      ' Step #8: Implement the CellConsumerInit event handler.
      ' The connected consumer part(s) will call this method during its 
      ' PartCommunicationInit phase
      ' to pass initialization information to this provider Web Part.
      ' <param name="sender">Reference to the Consumer Web Part</param>
      ' <param name="cellConsumerInitEventArgs">The argument data 
      ' structure passed by the Consumer Web Part</param>
      Public Sub CellConsumerInit(sender As Object, 
         cellConsumerInitEventArgs As CellConsumerInitEventArgs) 
         Implements ICellProvider.CellConsumerInit
         'Encode and store the field display name.
         _connectedField = SPEncode.HtmlEncode(cellConsumerInitEventArgs.FieldDisplayName)
      End Sub
        // Step #8: Implement the CellConsumerInit event handler.
        // The connected consumer part(s) will call this method during 
        // its PartCommunicationInit phase
        // to pass initialization information to this provider Web 
        // Part.
        // <param name="sender">Reference to the consumer Web 
        // Part</param>
        // <param name="cellConsumerInitEventArgs">The argument data 
        // structure passed by the consumer Web Part</param>
        public void CellConsumerInit(object sender, 
           CellConsumerInitEventArgs cellConsumerInitEventArgs)
        {
            //Encode and store the field display name.
            _connectedField = SPEncode.HtmlEncode(cellConsumerInitEventArgs.FieldDisplayName);

        }

See also

Reference

ICellProvider interface

ICellProvider members

Microsoft.SharePoint.WebPartPages.Communication namespace