this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Wednesday, November 30, 2011

Connected WebParts in SharePoint 2010

SharePoint has very cool features of connected Web Parts, It simply means that two different web parts are connected and they can share data between them.

In Connected Web Parts there are basically two things required at least, one is Consumer Web Parts and Provider Web Parts. Consumer Web Parts gets data from Provider Web Parts, and this data passing is usually done with use of interface.

Connected web parts are best when we have two different web parts and we want to change web parts activity based on external events happen in another web part exist in the same web page.

Here, MSDN contains very nice walk through for creating connected web parts.

In above article, two attributes plays role for connecting web parts

ConnectionProvider:

It should be attached to any one method which returns data, it does not necessary that it must have some value specified in the bracket, what so ever you write there will be displayed when you access web parts from SharePoint site.

ConnectionConsumer

It should be attached to any one method which gets data from another web part.

NOTE: when you use this connected web parts in Web Part page added in sharepoint, you will have option to connect with consumer web parts. But in case of default page you may require to turn to edit mode of your page and then click on edit of web part and then you will have this options of connecting to another consumer web part.

In above scenario it is assumed that firstly we have added both consumer and provider web parts in the page and then we will have option to connect web parts.

No comments: