Connecting web parts: The easy wayOctober 9, 2008 17:38
Since Moss2007 you can implement your own connection interface which enables you to connect customized web parts. It looks like you can basically transfer any serializable information. The first thing you have to do is to define a very simple interface. The second step is to inherit the interface at the web part class that sends the information. In this class you’ll have to assign the interface as the connection interface. The last step in the provider web part is to include the “get function” described by the interface to pass the value. In our consumer web part we have to retrieve the connection interface. Once this connection has been setup we can read and use the given value. In the example code we will use the interface with the name “IMossStringConnection” to pass a string value. Tags: code example, connect, consumer, interface, provider, string value, web part.Connecting a web part with a standard SharePoint listOctober 9, 2007 11:22
You’ll only have to add 3 extra functions to your web-part to make it work. After adding those functions you are able to connect the web part with a standard list in SharePoint. The required functions are the GetRowData & SetConnectionInterface and you will have to override the OnPreRender. Inside the GetRowData function you can write your personal code to read out the received row. The easiest way to figure out how to access the information from the returned rowData is to debug the code and then view the contents of the rowData object. In my example it turned out that the rowData is of the type DataRowView and that the document url can be extracted from the first position in the array. Tags: connect, Connection Interface, document list, GetRowData, IWebPartRow, OnPreRender, provider, Sharepoint. |
||