Posts mit dem Label Connections werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Connections werden angezeigt. Alle Posts anzeigen

Donnerstag, 29. Dezember 2011

How to get Name and other Information of the provider in the consumer WebPart

I needed to display the name of the provider webpart in a consumer WebPart when working with WebPartConnections. 

Here the code to access provider Information from the consumer WebPart:

SPWeb myWeb = SPControl.GetContextWeb(Context);
SPLimitedWebPartManager webPartManager = myWeb.GetLimitedWebPartManager(this.Page.Request.FilePath, PersonalizationScope.Shared);


foreach (SPWebPartConnection connection in webPartManager.SPWebPartConnections)
{
    if(writer != null)
        writer.Write("Provider: " + connection.Provider.Title
+ " - Consumer: " + connection.Consumer.Title + "<br />");
}