SharePoint 2010: Connected Web Parts in action

Connected WebParts are best suited for the scenarios where data communication between two WebParts is required at run time.

Following are the most basic steps involves in the development of Connected Web Parts:

Step1 : Creating WebPart connection interface

Step2 : Creating Provider WebPart using WebPart Project Item

Step3 : Creating Consumer WebPart using WebPart Project Item

Now lets see the connected WebPart in action.

  • Create Empty SharePoint Project

1

2

  • Creating WebPart connection interface : Add a class file which contains the definition of the interface.

3

  • Interface Definition

4

  • Creating Provider WebPart using WebPart Project Item : Add new project item based on WebPart project item type

5

6

  • Provider.cs: This file implements the business logic for Provider WebPart. This class will implement ConnectionProvider Property

78

  • Element.xml: This file will expose the deployment information of Provider WebPart to SharePoint

9

  • Creating Consumer WebPart using WebPart Project Item

10

11

  • Consumer.cs: This file implements the business logic for Provider WebPart. This class will implement ConnectionConsumer Property

1213

  • Element.xml: This file will expose the deployment information of Consumer WebPart to SharePoint
  • Creating Site Level Feature for the deployment of connected WebParts

14.1

  • Build and Deploy solution
  • Test Connected WebParts
  •      Create a new WebPart Page

15

16

17

  •      Add Provider and Consumer WebParts on the WebPart Page

18

  •     Create connection between Provider and Consumer WebParts

19

20

  •    Enter string in the Provider WebPart and click Send Button, the string value is transferred to the Consumer WebPart using connection between Provider and Consumer WebPart.

21

  •  Value transferred to Consumer WebPart on button click.

22

Hope this will help someone in need…

Advertisements