Web Parts Dynamic Connection
On this page we'll look at an ASP.NET Web Parts Dynamic Connection.
We can set connections between different webparts controls which are set up as 'Providers' and 'Consumers' (see Web Parts Static Connection. As mentioned in that article we can create the connections declaratively using a WebPartManager. This means we are pre-defining the connection before the user gets to the application. If we have multiple data sources we want to expose as web parts and multiple different web part controls which could consume those data sources, we could let the user decide which controls they want to connect with which data sources they want. This is where we can use dynamic connections in ASP.NET Web Parts.
We can allow users to create dynamic connections on the page, but we'll need to add a ConnectionsZone web parts control to the page (which will need the WebPartManager too of course). Once the user is logged in, the ConnectionsZone on the page enables the WebPartDisplayMode 'Connect' mode to become available. Upon selecting this option the 'Provider' and 'Consumer' web part controls add an additional menu option which is available from the web part properties menu, the option is called 'Connect'. Clicking on this for a Provider or Consumer activates the ConnectionsZone control. From here you can create a dynamic connection between a 'Provider' web part and a 'Consumer' web part.
<asp:ConnectionsZone ID="ConnectionsZone1" runat="server">