asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Connectable Web Parts in SharePoint Portal Server 2003 - Part 1
By Gayan Peiris
Rating: 3.1 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Introduction


    SharePoint Portal Server lets different developers and organisations develop Web Parts that can communicate with each other. The SharePoint architecture supports standard Connection Interfaces for passing information among Web Parts at runtime. The connectable Web Part will act as a provider Web Part by providing information to another Web Part or as a consumer Web Part by consuming information from a provider Web Part. Two Web Parts supported by a connection interface can be connected by an end user with either Microsoft Office Front Page or an Internet browser.

    Connection Interface Details

    There are few a different connection interfaces that provide different behaviors. The difference is mainly found in the amount of information that can be passed from one to another. For example, one interface can support providing a single value to a consumer Web Part. There are other interfaces that support more than a single value. The connectable Web Part raises an interface event that executes an action in Web Parts connected to it. These connection interfaces act as pairs by either being a provider or consumer Web Part. An event from the provider will trigger an action in the consumer Web Part, and an event from the consumer Web Part will trigger an action in the provider Web Part. The following are some of the connection interface pairs and their functionality.

    Connection Interface Pair

    Functionality

    ICellProvider, ICellConsumer

    Provide or consume a single value from one Web Part to another.

    IRowProvider, IRowConsumer

    Provide or consume a single or multiple rows of values from one Web Part to another.

    IListProvider, IListConsumer

    Provide or consume an entire list from one Web Part to another.

    IFilterProvider, IFilterConsumer

    Provide or consume a filter value.

    Table 1 Connection interface pairs and their functionality

    There are more connection interfaces available from the SharePoint architecture. However, I am mainly looking at interfaces connected using an Internet browser. There are a few more interfaces that are supported by Microsoft Front Page.

    Web Parts can be connected only if they are compatible with each other. If Web Parts are not compatible, the Connection menu item in the Web Part will be disabled, and a tool tip will display the reason why it is disabled.


    Figure 1 - Connection menu item disable

    Compatibility Rules

    The Web Part won't be able to connect to itself either directly or through a chain of connections. There are a few compatibility rules that SharePoint architecture follows when determining whether the Web Parts are compatible.

    • Are the Web Parts connecting as opposite pairs? For example, only ICellProvider interface can be connect with ICellConsumer interface.
    • Is the Web Part connecting through a Transformer? The Web Part architecture supports connecting dissimilar Web Parts with each other through transformers. For example, the IRowProvider Web Part can connect with either the IRowConsumer or the ICellConsumer Web Part. When it is connected to an ICellConsumer Web Part, the transformer determines which field will be consumed from the provider Web Part. The following are some of the transformers supported by connecting through a browser:

      IRowProvider to ICellConsumer
      IRowProvider to IFilterConsumer

    The following are some of the interfaces that support the cross page connections. This means Web Parts in two different pages can communicate with each other.

    Source page Interface

    Target page Interface

    IRowProvider

    IFilterConsumer

    IFilterProvider

    IFilterConsumer

    Table 2 Interfaces supporting cross page connection

    Web Parts can run on the client side, server side, or both. The connectable Web Part only can connect with other connectable Web Parts in the same location. This means both Web Parts should run either client side or server side. A client side Web Part won't be able to connect to a server side Web Part and vice versa.

    When the developer creates the Web Part, he can determine the number of connections supported by the Web Part. This is done when the interface is registered in the code. The connection number can be either one or unlimited.

    Connect Web Parts through an Internet Browser

    According to the SharePoint Portal Server 2003 Client section on Microsoft's SharePoint Portal Server 2003 System Requirements page, "To use the SharePoint Portal Server 2003 client, you need:

    Portal access:

    • Microsoft Internet Explorer 5.01, plus the latest service pack
    • Internet Explorer 5.5, plus the latest service pack
    • Internet Explorer 6, plus the latest service pack
    • Internet Explorer 5.2 for Mac OS X, plus the latest service pack
    • Netscape Navigator 6.2 or later
    • Netscape Navigator 6.2 for Mac
    • Netscape Navigator 6.2 for UNIX

    Portal management

    • Internet Explorer 5.5, plus the latest service pack
    • Internet Explorer 6, plus the latest service pack

    The Web page that contains the Web Parts should be in design view to support the connection functionality; otherwise, the connecting Web Part option won't be available to the end user. To access the design view of a SharePoint Web page, navigate to the top right hand corner and select Modify My Page or Modify Shared Page depending on whether the end user is using personal or shared view. Then select Design this page option from the dropdown menu as displayed below.


    Figure 2 - Selecting design view

    A right mark will indicate whether the page is in design view as displayed below.


    Figure 3 - The design view is selected

    There are more options available in a Web Part menu when its holding page is in design view. The Web Parts "Connections" option only is available when the Web Part is displayed in design view.

    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.


    Figure 4 - Connection information about Cell Provider 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.


    Figure 5 - "Cell Consumer Web Part" is available from the list.

    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.


    Figure 6 "Cell Consumer Web Part" is connected to "Cell Provider Web Part "Web Part

    Article three in this series will focus on how to create ICellConsumer Web Parts.

    Figure 7 displays the connection between and ICellProvider and ICellConsumer Web Part.

    Figure 7 - The connectable Web Parts

    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:

    Figure 8 - 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 overexposing 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 centralise it. End users having more control over their environment is better than depending on a developer in a portal environment.

    Conclusion

    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.

    About the Author

    Gayan Peiris is a Senior Consultant for Unique World Pty Ltd (www.uniqueworld.net) in Canberra, Australia. He is a MCSD with MCAD, MCP, Bcom and MIT certifications. Gayan has designed and developed Microsoft Web and Windows solutions since 1999. His expertise lies in developing scalable, high-performance applications with Microsoft Enterprise Server Products in .NET technology .His core skills are ADO.NET, ASP.NET, C#, VB.NET, Web Services, XML, SharePoint Portals, DNA and SQL Server.

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Other Articles
    Apr 21, 2005 - Building a FAQ Module for the ASP.NET Community Starter Kit
    This sample chapter from Packt Publishing's "Building Websites with the ASP.NET Community Starter Kit" illustrates how to build a new module on top of the existing code in the ASP.NET Community Starter Kit (CSK). Using a Frequently Asked Questions (FAQ) module as an example, it shows how creating a new module allows you to add entirely new features which integrate seamlessly with the rest of the framework.
    [Read This Article]  [Top]
    Oct 20, 2004 - Beyond the DataGrid: An Architectural View of the Data Source Model in ASP.NET 1.x and 2.0
    Dino Esposito discusses the differences between the DataGrid control in version 1.x and 2.0 of ASP.NET. In the process, he also builds an improved version of the 1.x control that can get you some of the new 2.0 features today.
    [Read This Article]  [Top]
    Aug 25, 2004 - Developing Web Parts with the ICellProvider Interface
    Most default SharePoint Server Web Parts can be connected across organizations. The second article in this series shows how to develop connectable Web Parts that provide information to other Web Parts.
    [Read This Article]  [Top]
    Aug 4, 2004 - Accessibility Improvements in ASP.NET 2.0 - Part 2
    Alex Homer continues to highlight some of the new ASP.NET 2.0 accessibility features. These features make it easier for visually impaired users to view and navigate Web sites and provide better support for alternative types of browsers and user agents.
    [Read This Article]  [Top]
    Jul 27, 2004 - Accessibility Improvements in ASP.NET 2.0 - Part 1
    Alex Homer highlights some of the new ASP.NET 2.0 accessibility features. These features make it easier for visually impaired users to view and navigate Web sites and provide better support for alternative types of browsers and user agents.
    [Read This Article]  [Top]
    Jun 30, 2004 - Simplified and Extended Data Binding Syntax in ASP.NET 2.0
    Alex Homer discusses the simplification of, and extensions to, the ASP.NET 1.x data binding syntax, the new two-way data binding syntax for updating data sources, and the new syntax for binding to XML data in ASP.NET 2.0.
    [Read This Article]  [Top]
    May 18, 2004 - ASP.NET 2.0 Caching Features
    This article examines some of the new and exciting caching features in ASP.NET 2.0 and shows how to implement them in Web applications.
    [Read This Article]  [Top]
    May 11, 2004 - SharePoint Security and .NET Impersonation
    When implementing custom components that require access to restricted resources, implicit impersonation must be used. Jay Nathan shows how to create a class that makes using .NET Impersonation a snap.
    [Read This Article]  [Top]
    May 4, 2004 - Creating a Flexible Configuration Section Handler
    Jeff Gonzalez demonstrates how to create a flexible configuration section handler using C#. He provides a summary background of the .NET configuration system, explains why the system is useful, and shows how it can be extended.
    [Read This Article]  [Top]
    Apr 21, 2004 - Creating a Web Custom Control
    Conrad Jalali shows how to build Web custom controls by creating one that displays checkboxes in a categorized, hierarchical view.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry