Connecting Web Part Exercise
I am using an ICellProvider Web Part to display the functionality of a connectable Web Part. The Cell Provider Web Part contains a textbox where end users can enter a value and a button. When the Cell Provider Web Part is connected to another Web Part, the value entered to the textbox will be passed to the consumer Web Part. Article two in this series will focus on how to create Cell Provider Web Parts.
The end users select the dropdown arrow at right hand corner of the Web Part when they are ready to connect the Web Part. End users should make sure that the page is in design view. The information about the Web Part will display as shown below, explaining the functionality of the Web Part.
The developer has the option to enter a meaningful description about the Web Part when developing it.
It will display a list of Web Parts that are compatible to connect to the Web Part as displayed below.
Currently only one Web Part is indicated compatible with the Provider Web Part. Simply clicking the “Cell Consumer Web Part” will connect the Cell Provider Web Part with “Cell Consumer Web Part”.
A right sign will indicate which Web Part is connected to what as displayed below.
Article three in this series will focus on how to create ICellConsumer Web Parts.
The connection between and ICellProvider and ICellConsumer Web Part.
The value entered in the textbox at Cell Provider Web Part will get consumed by Cell Consumer Web Part.
Disconnecting the Web Parts
To remove the connection between two Web Parts, navigate to design view of the Web page and click the connected Web Part title. (The connected Web Part title will display with a right mark in front.). A message will display to confirm your action as displayed below:
Removing connection between Web Parts.
Web Services and Connectable Web Parts
Web services are mainly developed to provide specific data to a consumer. The developer has full control over exposing the Web service. The connectable Web Parts provide the option to the end user. The connectable Web Part can stand alone as individual Web Parts providing their dedicated information and then connect them together to provide filtering of information.
For example, there can be an employee list Web Part and employee details Web Part. Both of the Web Parts can stand alone providing information. If the end user wants to display the details of a selected employee, the end user has the option to connect the employee list Web Part to the employee detail Web Part. In this way, when the end user selects an employee from the employee list, the selected employee details will display in the details Web Part.
If you develop a Web service to cater to the above scenario, the developer has full control of the end result. The functionality provided by the Web service is not visible to the end user and the end user won’t have knowledge or control to reuse the Web service if they need to in the future. At the end of the day it’s reliant on whether you want to create a dedicated Web service or individual Web Parts that can stand alone and work together if needed.
The biggest benefit Web Parts have over a Web service is the reusability and the option for the end user to have control of their environment. This is a very important aspect in a portal architecture where end users have control over what they see. Portals are mainly developed so that end users can gather information relevant to them and centralize it. End users having more control over their environment is better than depending on a developer in a portal environment.
The connectable Web Parts are similar to normal Web Parts. The only difference is they are inheriting from a connection interface class that provides capability to communicate with other Web Parts at run time, so they can act as service if needed. Articles two and three of this series will show how to develop connectable Web Parts using the ICellProvider and ICellConsumer interfaces.