Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 890853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:47:58+00:00 2026-05-15T13:47:58+00:00

I’m prototyping the best way to dynamically connect web parts at runtime. Essentailly, the

  • 0

I’m prototyping the best way to dynamically connect web parts at runtime. Essentailly, the application will allow for several disparate application groups to create web parts that will be consumed within the SharePoint front end. All of the web parts will need to automatically detect consumers and providers to create connections at runtime.

What we are looking to do is have webparts discover and automatically connect to other compatible webparts. When a user adds the two compatible parts to a page, the parts should be able create the appropriate connections. We have a well defined interface for passing data between the parts, so the only issue is how to manage the connections. To be clear, we do not want user’s to worry about having to create connections themselves.

For our purposes “best way” means most efficient, elegant and/or standard. We’d like to follow established sharepoint design patterns as much as possible, but code efficiency is somewhat important.

I’ve been able to draft a proof of concept that uses a base web part class to do this during the oninit event of each subclassed webpart. The oninit event grabs the current page’s SPWebPartManager and itereates through each part creating consumer and provider connections for every webpart inheriting from the base class:

SPWebPartManager spManager = SPWebPartManager.GetCurrentWebPartManager(Page) as SPWebPartManager;
foreach (BaseWebPart provider in parts)
{
    foreach (BaseWebPart consumer in parts)
    {
        if (provider != consumer)
        {
            string connectionId = string.Format("WebPartConnection{0}{1}", consumer.ID, provider.ID);
            SPWebPartConnection conn = spManager.SPWebPartConnections[connectionId];
            if (conn == null)
            {
                conn = new SPWebPartConnection()
                {
                    ID = connectionId,
                    ConsumerID = consumer.ID,
                    ConsumerConnectionPointID = "WebPartConnectableConsumer",
                    ProviderID = provider.ID,
                    ProviderConnectionPointID = "WebPartConnectableProvider"
                };
                spManager.SPWebPartConnections.Add(conn);
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:47:59+00:00Added an answer on May 15, 2026 at 1:47 pm

    I will highly recommend that you reconsider and then drop this idea.

    I know that it may be hard to teach all users to connect web parts, and you might get your functionallity to work in limited scenarios.

    But in more complicated scenarios you’re just asking for trouble and you’re limiting the possiblities of advanvced users.

    • If you implement a (or multiple) web part, which can consume and provide the same interface. Then put two of these on a page => Endless loop
    • If your user puts two providers and two consumers on the same page you have no way of pairing these as the user wants.
    • …

    My recommendation is that you develop your web parts so they can work both with and without connections (maybe hiding part of the UI if connected) and teach your users to use connections

    Or you could go halfway and when showing your webpart in design mode, list the web parts it can be connected to as links, which the user can click to make connections.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Seemingly simple, but I cannot find anything relevant on the web. What is the
I need a function that will clean a strings' special characters. I do NOT
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.