Using SharePoint Web Part Connections
By: Siddharth Mehta | Updated: 2010-09-29 | Comments | Related: > Sharepoint
Displaying relative information in the form of a master - detail view is one of the most common UI requirements.
For instance, a company could have several departments, and departments could have several employees. In most cases, there would be separate list of department and employees. One can use the list viewer web part to show department and employees all together at same page. But consider a scenario where the requirement is to display employees of the corresponding department.
In this tip we will look at how to deal with this requirement in SharePoint using "Web Part Connections".
"Web Part Connections" allow you to connect two different web parts on the same page. Conceptually speaking, one web part provides an input from a column to another web part's column. Depending upon the input, the target web part will get filtered. In this article, we will discuss how to use web part connections to solve the problem in question.
In the screenshot below, there are two list viewer web parts to display records from the Department List and the Employees List. The only common / matching data between the two lists is the DepartmentName column in Department List and the EmpDepartment column in Employees list. We will use this column to connect both web parts.
Select the Site Action -> Edit Page menu item.
As shown in the screenshot below, select Edit -> Connections -> Get Sort/Filter From -> Department. Here the Department web part placed as a separate web part above the employees web part.
Select Column DepartmentName for the Department List and Click on Next.
Select Column EmpDepartment for the Employees List and Click on Finish.
Click on Exit Mode.
Now you will be able to see two things:
- A selection button will appear in front of source web part records. Selecting of a record in Department web part will act as input to the Employees web part
- The corresponding records will get displayed in the target web part. The same can be seen in the screenshot below.
Now change the selection of DepartmentName to "Financial Securities" and you will notice the difference.
In summary, by using web part connections one can easily create master detail function linking between different web parts.
- Use Web Part Connections to connect more than one web parts and filter the data.
- Use Web Part Connections with business data catalog web parts to effectively sort third party data and display relative data
Last Updated: 2010-09-29
About the author
View all my tips