WebPart.PartCommunicationConnect method
NOTE: This API is now obsolete.
Usado para notificar um Web Part que tiver sido conectada a outra Web Part.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
<ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")> _
Public Overridable Sub PartCommunicationConnect ( _
interfaceName As String, _
connectedPart As WebPart, _
connectedInterfaceName As String, _
runAt As ConnectionRunAt _
)
'Uso
Dim instance As WebPart
Dim interfaceName As String
Dim connectedPart As WebPart
Dim connectedInterfaceName As String
Dim runAt As ConnectionRunAt
instance.PartCommunicationConnect(interfaceName, _
connectedPart, connectedInterfaceName, _
runAt)
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
public virtual void PartCommunicationConnect(
string interfaceName,
WebPart connectedPart,
string connectedInterfaceName,
ConnectionRunAt runAt
)
Parâmetros
interfaceName
Type: System.StringEspecifica o nome da interface nesta Web Part que estiver sendo conectada.
connectedPart
Type: Microsoft.SharePoint.WebPartPages.WebPartUm WebPart que especifica a outra Web Part que estiver sendo conectada ao.
connectedInterfaceName
Type: System.StringEspecifica o nome da interface que estiver sendo conectada em outra Web Part.
runAt
Type: Microsoft.SharePoint.WebPartPages.Communication.ConnectionRunAtUm valor deConnectionRunAtque especifica onde a interface nesta Web Part deverá ser executado.
Comentários
Uma Web Part que implementa uma interface de conexão deve substituir o método PartCommunicationConnect . Esse método é chamado pela infra-estrutura de Web Part para notificar a Web Part que ele esteja conectado durante o evento de System.Web.UI.Control.PreRender do Microsoft ASP.NET. Informações relevantes são passadas para a conexão Web Part, como a interface que ele está conectado sobre a Web Part que está sendo conectado à e onde a parte estará executando, no lado do cliente ou do servidor.
Se a Web Part que estiver sendo conectada ao estiver em outra página, connectedPart é a null reference (Nothing in Visual Basic).
Examples
O exemplo de código a seguir mostra um método substituído PartCommunicationConnect . Este exemplo de código é parte de um exemplo maior fornecido para a interface ICellProvider .
Como este exemplo usa a classe Microsoft.SharePoint.Utilities.SPEncode , ele requer uma diretiva de using (Imports no Visual Basic) para o namespace Microsoft.SharePoint.Utilities .
For an overview of the steps of creating a connectable Web Part, see Walkthrough: Creating a Connectable SharePoint Web Part.
Public Overrides Sub PartCommunicationConnect( _
interfaceName As String, _
connectedPart As WebPart, _
connectedInterfaceName As String, _
runAt As ConnectionRunAt)
' Keep track of whether the Web Part is connected.
If interfaceName = "MyCellProviderInterface_WPQ_" Then
_connected = True
_connectedWebPartTitle = SPEncode.HtmlEncode(connectedPart.Title)
End If
End Sub
// Step #7: Override the PartCommunicationConnect() method.
// The PartCommunicationConnect method is called by the Web Part infrastructure to notify the Web Part that it
// is connected during the ASP.NET PreRender event. Relevant information is passed to the part such as
// the interface it is connected over, the Web Part it is being conected to, and where the part will be running,
// either client-side or server-side.
// <param name="interfaceName">Friendly name of the interface that is being connected</param>
// <param name="connectedPart">Reference to the other Web Part that is being connected to</param>
// <param name="connectedInterfaceName">Friendly name of the interface on the other Web Part</param>
// <param name="runAt">Where the interface should execute</param>
public override void PartCommunicationConnect(
string interfaceName,
WebPart connectedPart,
string connectedInterfaceName,
ConnectionRunAt runAt)
{
// Keep track of whether the Web Part is connected.
if (interfaceName == "MyCellProviderInterface_WPQ_")
{
_connected = true;
_connectedWebPartTitle = SPEncode.HtmlEncode(connectedPart.Title);
}
}