共用方式為


ICellConsumer.CellProviderInit Method

NOTE: This API is now obsolete.

Handles the initialization event CellProviderInit. This event handler is of type CellProviderInitEventHandler.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")> _
Sub CellProviderInit ( _
    sender As Object, _
    cellProviderInitArgs As CellProviderInitEventArgs _
)
'Usage
Dim instance As ICellConsumer
Dim sender As Object
Dim cellProviderInitArgs As CellProviderInitEventArgs

instance.CellProviderInit(sender, cellProviderInitArgs)
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")]
void CellProviderInit(
    Object sender,
    CellProviderInitEventArgs cellProviderInitArgs
)

Parameters

Examples

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

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

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

See Also

Reference

ICellConsumer Interface

ICellConsumer Members

Microsoft.SharePoint.WebPartPages.Communication Namespace