IParametersOutProvider Interface

NOTE: This API is now obsolete.

Allows a provider Web Part to communicate its parameter list to other Web Parts.

Namespace:  Microsoft.SharePoint.WebPartPages.Communication
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Public Interface IParametersOutProvider
'Usage
Dim instance As IParametersOutProvider
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
public interface IParametersOutProvider

Remarks

The IParametersOutProvider interface should be used with parts that need to pass a general collection of parameters. It can be used in scenarios where the consumer Web Part was designed with an understanding of the data being sent by the provider. Also, the IParametersOutProvider part has the ability to pass initialization arguments to the consumer part. Because the IParametersOutProvider can connect to both the IParametersOutConsumer and the IParametersInConsumer interfaces, it is a good choice as a provider of parameters. Also, server-side implementations of IParametersOutProvider can be connected to parts on a different page by using an HTML editor compatible with Microsoft SharePoint Foundation, such as Microsoft SharePoint Designer.

When connecting the IParametersOutProvider to IParametersOutConsumer, the connection is direct, so no transformer dialog box is displayed. When connecting the IParametersOutProvider to IParametersInConsumer, a transformer dialog is displayed which allows an end user to map the parameter values between the parts. In this case, the consuming part doesn't need to be designed with intimate knowledge of the provider because the end user is performing the mapping. However, this does require the user to have a deeper understanding of the functionality of the Web Parts being connected. Web Parts that implement the IParametersOutProvider interface can only be connected to an IParametersInConsumer Web Part by using an HTML editor compatible with SharePoint Foundation, such as SharePoint Designer.

The IParametersOutProvider and IParametersOutConsumer interfaces also allow passing additional information such as a selected row. For example, when a user clicks on a row in a list, the row data along with the parameters can be passed through these interfaces.

Examples

The following code example shows a simple server-side IParametersOutProvider Web Part. It can be connected to one or more Web Parts which implement the IParametersOutConsumer or IParametersInConsumer interfaces on the server. This example displays a series of drop-down list boxes for font attributes such as size, color, weight, and family. When the attribute values are saved, this Web Part passes the parameters to all other Web Parts connected to it.

There are 9 steps specific to making this a connectable Web Part. These steps are numbered and commented in the following sample code.

' Common .NET required namespaces
Imports System
Imports System.ComponentModel
Imports System.Web.UI

' WebPart required namespaces
Imports Microsoft.SharePoint.WebPartPages
Imports System.Xml.Serialization
Imports System.Web.UI.WebControls

' Required for ArrayLists
Imports System.Collections

' Code Access Security namespaces
Imports System.Security
Imports Microsoft.SharePoint.Utilities

'Step #1: Reference the Communication namespace.
Imports Microsoft.SharePoint.WebPartPages.Communication

Namespace ConnectionCodeSamples
   ' Step #2: Inherit from the WebPart base class and implement the 
   ' IParametersOutProvider interface.
   
   Public Class ServerSideParametersOutProvider
      Inherits WebPart
      Implements IParametersOutProvider
      
      ' Step #3: Declare the IParametersOutProvider events.
      ' Because this class implements the IParametersOutProvider 
      ' interface, it must  declare the interface members 
      ' ParametersOutProviderInit, ParametersOutReady, and 
      ' NoParametersOut. 
      Public Event ParametersOutProviderInit As ParametersOutProviderInitEventHandler Implements IParametersOutProvider.ParametersOutProviderInit
      Public Event ParametersOutReady As ParametersOutReadyEventHandler Implements IParametersOutProvider.ParametersOutReady
      Public Event NoParametersOut As NoParametersOutEventHandler Implements IParametersOutProvider.NoParametersOut
      
      ' Declare variables for keeping track of connection state.
      Private _connected As Boolean = False
      Private _connectedWebPartTitle As String = String.Empty
      Private _registrationErrorMsg As String = "An error has occurred trying to register your connection interfaces."
      Private _registrationErrorOccurred As Boolean = False
      Private _notConnectedMsg As String = "NOT CONNECTED. To use this Web Part connect it to a ParametersOut or ParametersIn Consumer Web Part."
      
      ' Declare variables for Web Part user interface.
      Private _connectedWebPartLabel As String = "Connected to Web Part"
      Private _fontFamilyListBox As DropDownList
      Private _fontColorListBox As DropDownList
      Private _fontWeightListBox As DropDownList
      Private _fontSizeListBox As DropDownList
      Private _fontFamilyArrayList As ArrayList
      Private _fontColorArrayList As ArrayList
      Private _fontWeightArrayList As ArrayList
      Private _fontSizeArrayList As ArrayList
      Private _parametersReadyButton As Button
      Private _parametersReadyButtonClicked As Boolean = False
      Private _noParametersOutButton As Button
      Private _noParametersOutButtonClicked As Boolean = False
      
      ' Declare variables for Parameter attributes.
      Private _fontFamilyParamDescription As String = "Font Family"
      Private _fontFamilyParamDisplayName As String = "Font"
      Private _fontFamilyParamName As String = "FontFamily"
      Private _fontColorParamDescription As String = "Font Color"
      Private _fontColorParamDisplayName As String = "Color"
      Private _fontColorParamName As String = "FontColor"
      Private _fontWeightParamDescription As String = "Font Weight"
      Private _fontWeightParamDisplayName As String = "Weight"
      Private _fontWeightParamName As String = "FontWeight"
      Private _fontSizeParamDescription As String = "Font Size"
      Private _fontSizeParamDisplayName As String = "Size"
      Private _fontSizeParamName As String = "FontSize"
      
      
      ' Constructor
      Public Sub New()
         ' Create Array List objects.
         _fontFamilyArrayList = New ArrayList()
         _fontColorArrayList = New ArrayList()
         _fontWeightArrayList = New ArrayList()
         _fontSizeArrayList = New ArrayList()
         
         ' Add items to _fontFamilyArrayList.
         _fontFamilyArrayList.Add("Times")
         _fontFamilyArrayList.Add("Arial")
         _fontFamilyArrayList.Add("Verdana")
         _fontFamilyArrayList.Add("Courier")
         
         ' Add items to _fontColorArrayList.
         _fontColorArrayList.Add("Black")
         _fontColorArrayList.Add("Red")
         _fontColorArrayList.Add("Green")
         _fontColorArrayList.Add("Yellow")
         _fontColorArrayList.Add("Blue")
         
         ' Add items to _fontWeightArrayList.
         _fontWeightArrayList.Add("Normal")
         _fontWeightArrayList.Add("Bold")
         
         ' Add items to _fontSizeArrayList.
         _fontSizeArrayList.Add("10pt")
         _fontSizeArrayList.Add("12pt")
         _fontSizeArrayList.Add("14pt")
         _fontSizeArrayList.Add("20pt")
      End Sub
       
      
      ' Step #4: Override the EnsureInterfaces method and call 
      ' RegisterInterface method.
      ' The EnsureInterfaces method is called by the Web Part 
      ' infrastructure during the ASP.NET PreRender event 
      ' and allows the part to register all of its connection 
      ' interfaces.
      Public Overrides Sub EnsureInterfaces()
         ' If your Web Part is installed in the bin directory and the 
         ' Code Access Security (CAS) setting doesn't 
         ' allow Web Part Connections, an exception will be thrown. To 
         ' allow your Web Part to behave 
         ' well and continue working, a try/catch block should be used 
         ' when attempting to register interfaces.
         ' Web Part Connections will only work if the level attribute 
         ' of the <trust> tag in the 
         ' web.config file is set to WSS_Minimal, WSS_Medium, or Full. 
         ' By default a new SharePoint site
         ' is installed with the trust level set to WSS_Minimal.
         Try
            ' Register the IParametersOutProvider Interface
            ' <param name="interfaceName">Friendly name of the 
            ' interface that is being implemented.</param>
            ' <param name="interfaceType">Specifies which interface is 
            ' being implemented.</param>
            ' <param name="maxConnections">Defines how many times this 
            ' interface can be connected.</param>
            ' <param name="runAtOptions">Determines where the interface 
            ' can run.</param>
            ' <param name="interfaceObject">Reference to the object 
            ' that is implementing this interface.</param>
            ' <param name="interfaceClientReference">Name used to 
            ' reference the interface on the client. 
            ' This is a server side example so the value is set to 
            ' empty string.</param>
            ' <param name="menuLabel">Label for the interface that 
            ' appears in the UI</param>
            ' <param name="description">Description of the interface 
            ' that appears in the UI</param>
            ' <param name="allowCrossPageConnection">Specifies if the 
            ' interface can connect to a Web Part
            ' on a different page. This is an optional parameter with a 
            ' default of false. Note that only some 
            ' server side interfaces are allowed to connect across 
            ' pages by the Web Part infrastructure. 
            ' The IParametersOutProvider interface is allowed to 
            ' connect across pages.</param>
            RegisterInterface("MyParametersOutProviderInterface", InterfaceTypes.IParametersOutProvider, WebPart.UnlimitedConnections, ConnectionRunAt.Server, Me, "", "Provide Parameters To", "Provides a font parameters to a consumer Web Part.", True)  

         Catch se As SecurityException
            _registrationErrorOccurred = True
         End Try
      End Sub
          
      
      ' Step #5: Override the CanRunAt method.
      ' The CanRunAt method is called by the Web Part infrastructure 
      ' during the ASP.NET PreRender event
      ' to determine where the Web Part can run based on its current 
      ' configuration.
      Public Overrides Function CanRunAt() As ConnectionRunAt
         ' This Web Part can run on the server.
         Return ConnectionRunAt.Server
      End Function 
      
      
      ' Step #6: Override the PartCommunicationConnect method.
      ' The PartCommunicationConnect method is called by the Web Part 
      ' infrastructure to notify the Web Part that it
      ' is connected during the ASP.NET PreRender event. Relevant 
      ' information is passed to the part such as 
      ' the interface it is connected over, the Web Part it is being 
      ' connected to, and where the part will be running, 
      ' either client or server side. 
      ' <param name="interfaceName">Friendly name of the interface that 
      ' is being connected</param>
      ' <param name="connectedPart">Reference to the other Web Part 
      ' that is being connected to</param>
      ' <param name="connectedInterfaceName">Friendly name of the 
      ' interface on the other Web Part</param>
      ' <param name="runAt">Where the interface should execute</param>
      Public Overrides Sub PartCommunicationConnect(interfaceName As String, connectedPart As WebPart, connectedInterfaceName As String, runAt As ConnectionRunAt)
         ' Keep track of connection state.
         If interfaceName = "MyParametersOutProviderInterface" Then
            _connected = True
            _connectedWebPartTitle = SPEncode.HtmlEncode(connectedPart.Title)
         End If
      End Sub
      
      ' Step #7: Override the PartCommunicationInit method.
      ' The PartCommunicationInit method is called by the Web Part 
      ' infrastructure during the ASP.NET PreRender 
      ' phase to allow the part to pass initialization information to 
      ' the other connected parts.
      ' It is important to always pass initialization information. Some 
      ' parts may not behave properly if this initialization 
      ' information is not received. 
      Public Overrides Sub PartCommunicationInit()
            ' Ensure that all of the Web Part's controls are created.
            EnsureChildControls()

            ' Check if connected.
            If _connected Then
                ' Need to create the ParametersOutProviderInitEventArgs 
                ' object for the ParametersOutProviderInit event.
                Dim parametersOutProviderInitInitEventArgs As New ParametersOutProviderInitEventArgs()

                ' Set the ParameterOutProperties.
                parametersOutProviderInitInitEventArgs.ParameterOutProperties = New ParameterOutProperty(3) {}

                ' There are 4 parameters types that will be passed: 
                ' Font Family, Color, Weight, and Size.
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(0) = New ParameterOutProperty()
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).Description = _fontFamilyParamDescription
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).ParameterDisplayName = _fontFamilyParamDisplayName
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).ParameterName = _fontFamilyParamName

                parametersOutProviderInitInitEventArgs.ParameterOutProperties(1) = New ParameterOutProperty()
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).Description = _fontColorParamDescription
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).ParameterDisplayName = _fontColorParamDisplayName
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).ParameterName = _fontColorParamName

                parametersOutProviderInitInitEventArgs.ParameterOutProperties(2) = New ParameterOutProperty()
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).Description = _fontWeightParamDescription
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).ParameterDisplayName = _fontWeightParamDisplayName
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).ParameterName = _fontWeightParamName

                parametersOutProviderInitInitEventArgs.ParameterOutProperties(3) = New ParameterOutProperty()
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).Description = _fontSizeParamDescription
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).ParameterDisplayName = _fontSizeParamDisplayName
                parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).ParameterName = _fontSizeParamName

                ' Fire the ParametersOutProviderInit event.
                RaiseEvent ParametersOutProviderInit(Me, parametersOutProviderInitInitEventArgs)
            End If
        End Sub
      
      
      ' Step #8: Override the PartCommunicationMain() method.
      ' The PartCommunicationMain method is called by the Web Part 
      ' infrastructure on the client during the ASP.NET PreRender
      ' event to allow the part to pass its primary data to the other 
      ' connected parts.
      ' It is important to always fire either the ParametersOutReady or 
      ' the NoParametersOut event. Some parts
      ' may not behave properly if they are left waiting for this 
      ' information. ParametersOutReady should be fired to send the 
      ' parameters. NoParametersOut should be fired to indicate that 
      ' there is no change in the parameters.
       Public Overrides Sub PartCommunicationMain()
            ' Ensure that all of the Web Part's controls are created.
            EnsureChildControls()

            ' Check if connected.
            If _connected Then
                ' Need to create the ParametersOutReadyEventArgs object for the ParametersOutReady event.
                Dim parametersOutReadyEventArgs As New ParametersOutReadyEventArgs()

                If _parametersReadyButtonClicked Then 'ParametersOutReady Button was clicked
                    ' Set the values to the values of the text boxes.
                    parametersOutReadyEventArgs.ParameterValues = New String(3) {}
                    parametersOutReadyEventArgs.ParameterValues(0) = _fontFamilyListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(1) = _fontColorListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(2) = _fontWeightListBox.SelectedItem.Value
                    parametersOutReadyEventArgs.ParameterValues(3) = _fontSizeListBox.SelectedItem.Value

                    ' Fire the ParametersOutReady event.
                    RaiseEvent ParametersOutReady(Me, parametersOutReadyEventArgs)
                    _parametersReadyButtonClicked = False
                    'The NoParametersOut button was clicked.
                ElseIf _noParametersOutButtonClicked Then
                    ' Fire the event.
                    RaiseEvent NoParametersOut(Me, New EventArgs())
                    _noParametersOutButtonClicked = False
                    ' The user didn't click any button.
                Else
                    ' Fire the event.
                    RaiseEvent NoParametersOut(Me, New EventArgs())
                    _noParametersOutButtonClicked = False
                End If
            End If
        End Sub      
      
      ' Step #9: Override the GetInitEventArgs method.
      ' GetInitEventArgs() is called by the Web Part infrastructure 
      ' during the ASP.NET PreRender event to gather the 
      ' necessary information it needs to build the transformer dialog. 
      ' The transformer dialog is needed when connecting different 
      ' interfaces such as IRowProvider to ICellConsumer. The 
      ' transformer dialog allows the user to map the fields between 
      ' the interfaces. The GetInitEventArgs()method only needs to be 
      ' implemented for interfaces that can participate in a 
      ' transformer which are the following:
      ' ICellConsumer, IRowProvider, IFilterConsumer, 
      ' IParametersOutProvider, IParametersInConsumer.
      ' <param name="interfacename">Name of interface on which the Web 
      ' Part infrastructure is requesting information</param>
      ' <returns>An InitEventArgs object</returns>
      Public Overrides Function GetInitEventArgs(interfaceName As String) As InitEventArgs
         ' Check if this is my particular ParametersOut interface.
         If interfaceName = "MyParametersOutProviderInterface" Then
            ' Ensure that child controls have been created
            EnsureChildControls()
            
            ' Need to create the ParametersOutProviderInitEventArgs 
            ' object for the ParametersOutProviderInit event.
            Dim parametersOutProviderInitInitEventArgs As New ParametersOutProviderInitEventArgs()
            
            ' Set the ParameterOutProperties.
            parametersOutProviderInitInitEventArgs.ParameterOutProperties = New ParameterOutProperty(3) {}
            
            'There are 4 parameters types that will be passed: Font Family, Color, Weight, and Size
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(0) = New ParameterOutProperty()
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).Description = _fontFamilyParamDescription
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).ParameterDisplayName = _fontFamilyParamDisplayName
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(0).ParameterName = _fontFamilyParamName
            
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(1) = New ParameterOutProperty()
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).Description = _fontColorParamDescription
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).ParameterDisplayName = _fontColorParamDisplayName
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(1).ParameterName = _fontColorParamName
            
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(2) = New ParameterOutProperty()
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).Description = _fontWeightParamDescription
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).ParameterDisplayName = _fontWeightParamDisplayName
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(2).ParameterName = _fontWeightParamName
            
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(3) = New ParameterOutProperty()
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).Description = _fontSizeParamDescription
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).ParameterDisplayName = _fontSizeParamDisplayName
            parametersOutProviderInitInitEventArgs.ParameterOutProperties(3).ParameterName = _fontSizeParamName
            
            ' Return the parametersOutProviderInitInitEventArgs object.
            Return parametersOutProviderInitInitEventArgs
         Else
            Return Nothing
         End If
      End Function
      
      
      Protected Overrides Sub RenderWebPart(output As HtmlTextWriter)
         ' Check for connection interface registration error.
         If _registrationErrorOccurred Then
            output.Write(_registrationErrorMsg)
            Return
         End If
         
         ' Ensure that all of the Web Part's controls are created.
         EnsureChildControls()
         
         ' Check if connected.
         If _connected Then
            ' Render List Box table.
            output.RenderBeginTag(HtmlTextWriterTag.Table) 'Begin Table
            ' Font Family Row.
            output.RenderBeginTag(HtmlTextWriterTag.Tr) 'Begin TR
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            output.RenderBeginTag(HtmlTextWriterTag.B) 'Begin B
            output.Write((_fontFamilyParamDisplayName + ": ")) 'Render List Box Label
            output.RenderEndTag() 'End </B>
            output.RenderEndTag() 'End </TD>
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            _fontFamilyListBox.RenderControl(output) 'Render list box
            output.RenderEndTag() 'End </TD>
            output.RenderEndTag() 'End </TR>
            ' Font Color Row.
            output.RenderBeginTag(HtmlTextWriterTag.Tr) 'Begin TR
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            output.RenderBeginTag(HtmlTextWriterTag.B) 'Begin B
            output.Write((_fontColorParamDisplayName + ": ")) 'Render List Box Label
            output.RenderEndTag() 'End </B>
            output.RenderEndTag() 'End </TD>
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            _fontColorListBox.RenderControl(output) 'Render list box
            output.RenderEndTag() 'End </TD>
            output.RenderEndTag() 'End </TR>
            ' Font Weight Row.
            output.RenderBeginTag(HtmlTextWriterTag.Tr) 'Begin TR
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            output.RenderBeginTag(HtmlTextWriterTag.B) 'Begin B
            output.Write((_fontWeightParamDisplayName + ": ")) 'Render List Box Label
            output.RenderEndTag() 'End </B>
            output.RenderEndTag() 'End </TD>
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            _fontWeightListBox.RenderControl(output) 'Render list box
            output.RenderEndTag() 'End </TD>
            output.RenderEndTag() 'End </TR>
            ' Font Size Row.
            output.RenderBeginTag(HtmlTextWriterTag.Tr) 'Begin TR
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            output.RenderBeginTag(HtmlTextWriterTag.B) 'Begin B
            output.Write((_fontSizeParamDisplayName + ": ")) 'Render List Box Label
            output.RenderEndTag() 'End </B>
            output.RenderEndTag() 'End </TD>
            output.RenderBeginTag(HtmlTextWriterTag.Td) 'Begin TD
            _fontSizeListBox.RenderControl(output) 'Render list box
            output.RenderEndTag() 'End </TD>
            output.RenderEndTag() 'End </TR>
            output.RenderEndTag() 'End <Table>
            
            ' Render buttons.
            _parametersReadyButton.RenderControl(output)
            _noParametersOutButton.RenderControl(output)
            
            ' Line break.
            output.RenderBeginTag(HtmlTextWriterTag.Br)
            output.RenderEndTag()
            
            ' Render connected Web Part title.
            output.Write((_connectedWebPartLabel + ": "))
            output.RenderBeginTag(HtmlTextWriterTag.I)
            output.Write(_connectedWebPartTitle)
            output.RenderEndTag()
         
         Else
            ' The Web Part isn't connected.
            output.Write(_notConnectedMsg)
         End If
      End Sub
       
      
      ' Create Web Part user interface controls.
      Protected Overrides Sub CreateChildControls()
         ' Create List Boxes.
         _fontFamilyListBox = New DropDownList()
         _fontColorListBox = New DropDownList()
         _fontWeightListBox = New DropDownList()
         _fontSizeListBox = New DropDownList()
         
         ' Set List Box IDs.
         _fontFamilyListBox.ID = "FontFamilyListBox"
         _fontColorListBox.ID = "FontColorListBox"
         _fontWeightListBox.ID = "FontWeightListBox"
         _fontSizeListBox.ID = "FontSizeListBox"
         
         ' Set List Box Values.
         _fontFamilyListBox.DataSource = _fontFamilyArrayList
         _fontColorListBox.DataSource = _fontColorArrayList
         _fontWeightListBox.DataSource = _fontWeightArrayList
         _fontSizeListBox.DataSource = _fontSizeArrayList
         
         ' Databind the List Boxes.
         _fontFamilyListBox.DataBind()
         _fontColorListBox.DataBind()
         _fontWeightListBox.DataBind()
         _fontSizeListBox.DataBind()
         
         ' Add List Boxes to Controls Collection.
         Controls.Add(_fontFamilyListBox)
         Controls.Add(_fontColorListBox)
         Controls.Add(_fontWeightListBox)
         Controls.Add(_fontSizeListBox)
         
         ' Create the ParametersOutReady button.
         _parametersReadyButton = New Button()
         _parametersReadyButton.ID = "ParametersOutReadyButton"
         _parametersReadyButton.Text = "Fire ParametersOutReady"
         Controls.Add(_parametersReadyButton)
         
         ' Create the NoParametersOut button.
         _noParametersOutButton = New Button()
         _noParametersOutButton.ID = "NoParametersOutButton"
         _noParametersOutButton.Text = "Fire NoParametersOut"
         Controls.Add(_noParametersOutButton)
         
         
         ' Hook up button clicks.
         _parametersReadyButtonClicked = False ' Initialize to false -- user hasn't clicked yet
         AddHandler _parametersReadyButton.Click, AddressOf ParametersOutReadyButtonClicked ' listen for Button's click event
         _noParametersOutButtonClicked = False ' Initialize to false -- user hasn't clicked yet
         AddHandler _noParametersOutButton.Click, AddressOf NoParametersOutButtonClicked ' listen for Button's click event
      End Sub
      
      
      ' The ParametersOutReadyButton OnClick event handler.
      ' <param name="sender">The Button object</param>
      ' <param name="e">The Event Arguments</param>
      Private Sub ParametersOutReadyButtonClicked(sender As Object, e As EventArgs)
         _parametersReadyButtonClicked = True 'user clicked button, set to true
      End Sub
          
      
      ' The NoParametersOutButton OnClick event handler.
      ' <param name="sender">The Button object</param>
      ' <param name="e">The Event Arguments</param>
      Private Sub NoParametersOutButtonClicked(sender As Object, e As EventArgs)
         _noParametersOutButtonClicked = True 'user clicked button, set to true
      End Sub
   End Class
End Namespace
// Common .NET required namespaces
using System;
using System.ComponentModel;
using System.Web.UI;

// WebPart required namespaces
using Microsoft.SharePoint.WebPartPages;
using System.Xml.Serialization;
using System.Web.UI.WebControls;

// Required for ArrayLists
using System.Collections;

// Code Access Security namespaces
using System.Security;
using Microsoft.SharePoint.Utilities;

//Step #1: Reference the Communication namespace.
using Microsoft.SharePoint.WebPartPages.Communication;


namespace ConnectionCodeSamples
{
    // Step #2: Inherit from the WebPart base class and implement the 
    // IParametersOutProvider interface.
    public class ServerSideParametersOutProvider : WebPart, IParametersOutProvider
    {    
        
        // Step #3: Declare the IParametersOutProvider events.
        // Because this class implements the IParametersOutProvider 
        // interface, it must declare the interface members 
        // ParametersOutProviderInit, ParametersOutReady, and 
        // NoParametersOut. 
        
        public event ParametersOutProviderInitEventHandler ParametersOutProviderInit;
        public event ParametersOutReadyEventHandler ParametersOutReady;
        public event NoParametersOutEventHandler NoParametersOut;        

        // Declare variables for keeping track of connection state.
        private bool _connected = false;
        private string _connectedWebPartTitle = string.Empty;
        private string _registrationErrorMsg = "An error has occurred trying to register your connection interfaces.";
        private bool _registrationErrorOccurred = false;
        private string _notConnectedMsg = "NOT CONNECTED. To use this Web Part connect it to a ParametersOut or ParametersIn Consumer Web Part.";

        // Declare variables for Web Part user interface.
        private string _connectedWebPartLabel = "Connected to Web Part";    
        DropDownList _fontFamilyListBox;
        DropDownList _fontColorListBox;
        DropDownList _fontWeightListBox;
        DropDownList _fontSizeListBox;
        ArrayList _fontFamilyArrayList;
        ArrayList _fontColorArrayList;
        ArrayList _fontWeightArrayList;
        ArrayList _fontSizeArrayList;
        private Button _parametersReadyButton;
        private bool _parametersReadyButtonClicked = false;
        private Button _noParametersOutButton;
        private bool _noParametersOutButtonClicked = false;

        // Declare variables for Parameter attributes.
        string _fontFamilyParamDescription = "Font Family";
        string _fontFamilyParamDisplayName = "Font";
        string _fontFamilyParamName = "FontFamily";
        string _fontColorParamDescription = "Font Color";
        string _fontColorParamDisplayName = "Color";
        string _fontColorParamName = "FontColor";
        string _fontWeightParamDescription = "Font Weight";
        string _fontWeightParamDisplayName = "Weight";
        string _fontWeightParamName = "FontWeight";
        string _fontSizeParamDescription = "Font Size";
        string _fontSizeParamDisplayName = "Size";
        string _fontSizeParamName = "FontSize";

        // Constructor
        public ServerSideParametersOutProvider()
        {
            // Create Array List objects.
            _fontFamilyArrayList = new ArrayList();
            _fontColorArrayList = new ArrayList();
            _fontWeightArrayList = new ArrayList();
            _fontSizeArrayList = new ArrayList();

            // Add items to _fontFamilyArrayList.
            _fontFamilyArrayList.Add("Times");
            _fontFamilyArrayList.Add("Arial");
            _fontFamilyArrayList.Add("Verdana");
            _fontFamilyArrayList.Add("Courier");

            // Add items to _fontColorArrayList.
            _fontColorArrayList.Add("Black");
            _fontColorArrayList.Add("Red");
            _fontColorArrayList.Add("Green");
            _fontColorArrayList.Add("Yellow");
            _fontColorArrayList.Add("Blue");

            // Add items to _fontWeightArrayList.
            _fontWeightArrayList.Add("Normal");
            _fontWeightArrayList.Add("Bold");

            // Add items to _fontSizeArrayList.
            _fontSizeArrayList.Add("10pt");
            _fontSizeArrayList.Add("12pt");
            _fontSizeArrayList.Add("14pt");
            _fontSizeArrayList.Add("20pt");

        }

        // Step #4: Override the EnsureInterfaces method and call 
        // RegisterInterface method.
        // The EnsureInterfaces method is called by the Web Part 
        // infrastructure during the ASP.NET PreRender event 
        // and allows the part to register all of its connection 
        // interfaces.
        
        public override void EnsureInterfaces()
        {
            // If your Web Part is installed in the bin directory and 
            // the Code Access Security (CAS) setting doesn't 
            // allow Web Part Connections, an exception will be thrown. 
            // To allow your Web Part to behave 
            // well and continue working, a try/catch block should be 
            // used when attempting to register interfaces.
            // Web Part Connections will only work if the level 
            // attribute of the <trust> tag in the 
            // web.config file is set to WSS_Minimal, WSS_Medium, or 
            // Full. By default a new SharePoint site
            // is installed with the trust level set to WSS_Minimal.
            try
            {
                // Register the IParametersOutProvider Interface
                // <param name="interfaceName">Friendly name of the 
                // interface that is being implemented.</param>
                // <param name="interfaceType">Specifies which 
                // <interface is being implemented.</param>
                // <param name="maxConnections">Defines how many times 
                // <this interface can be connected.</param>
                // <param name="runAtOptions">Determines where the 
                // <interface can run.</param>
                // <param name="interfaceObject">Reference to the 
                // <object that is implementing this interface.</param>
                // <param name="interfaceClientReference">Name used to 
                // <reference the interface on the client. 
                // This is a server side example so the value is set to 
                // <empty string.</param>
                // <param name="menuLabel">Label for the interface 
                // <that appears in the UI</param>
                // <param name="description">Description of the 
                // <interface that appears in the UI</param>
                // <param name="allowCrossPageConnection">Specifies if 
                // <the interface can connect to a Web Part
                // on a different page. This is an optional parameter 
                // <with a default of false. Note that only some 
                // server side interfaces are allowed to connect across 
                // <pages by the Web Part infrastructure. 
                // The IParametersOutProvider interface is allowed to 
                // <connect across pages.</param>
                RegisterInterface("MyParametersOutProviderInterface",        //InterfaceName    
                    InterfaceTypes.IParametersOutProvider,                    //InterfaceType
                    WebPart.UnlimitedConnections,                            //MaxConnections
                    ConnectionRunAt.Server,                                    //RunAtOptions
                    this,                                                    //InterfaceObject
                    "",                                                        //InterfaceClientReference
                    "Provide Parameters To",                                //MenuLabel
                    "Provides a font parameters to a consumer Web Part.",    //Description
                    true);                                                    //allowCrossPageConnection
            }
            catch(SecurityException se)
            {
                _registrationErrorOccurred = true;
            }
        }

        
        // Step #5: Override the CanRunAt method.
        // The CanRunAt method is called by the Web Part infrastructure 
        // during the ASP.NET PreRender event
        // to determine where the Web Part can run based on its current 
        // configuration.
        
        public override ConnectionRunAt CanRunAt()
        {
            // This Web Part can run on the server.
            return ConnectionRunAt.Server;
        }

        // Step #6: Override the PartCommunicationConnect method.
        // The PartCommunicationConnect method is called by the Web 
        // Part infrastructure to notify the Web Part that it
        // is connected during the ASP.NET PreRender event. Relevant 
        // information is passed to the part such as 
        // the interface it is connected over, the Web Part it is being 
        // connected to, and where the part will be running, 
        // either client or server side. 
        // <param name="interfaceName">Friendly name of the interface 
        // that is being connected</param>
        // <param name="connectedPart">Reference to the other Web Part 
        // that is being connected to</param>
        // <param name="connectedInterfaceName">Friendly name of the 
        // interface on the other Web Part</param>
        // <param name="runAt">Where the interface should 
        // execute</param>
        public override void PartCommunicationConnect(
            string interfaceName,
            WebPart connectedPart,
            string connectedInterfaceName,
            ConnectionRunAt runAt)
        {
            // Keep track of connection state.
            if (interfaceName == "MyParametersOutProviderInterface")
            {
                _connected = true;
                _connectedWebPartTitle = SPEncode.HtmlEncode(connectedPart.Title);
            }
        }

        // Step #7: Override the PartCommunicationInit method.
        // The PartCommunicationInit method is called by the Web Part 
        // infrastructure during the ASP.NET PreRender 
        // phase to allow the part to pass initialization information 
        // to the other connected parts.
        // It is important to always pass initialization information. 
        // Some parts may not behave properly if this initialization 
        // information is not received.
        
        public override void PartCommunicationInit()
        {
            // Ensure that all of the Web Part's controls are created.
            EnsureChildControls();

            // Check if connected.
            if(_connected)
            {
                // If there is a listener, fire the 
                // ParametersOutProviderInit event.
                if (ParametersOutProviderInit != null)
                {
                    // Need to create the 
                    // ParametersOutProviderInitEventArgs object for 
                    // the ParametersOutProviderInit event.
                    ParametersOutProviderInitEventArgs parametersOutProviderInitInitEventArgs = new ParametersOutProviderInitEventArgs();
                    
                    // Set the ParameterOutProperties.
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties = new ParameterOutProperty[4];

                    // There are 4 parameters types that will be 
                    // passed: Font Family, Color, Weight, and Size.
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[0] = new ParameterOutProperty();
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].Description = _fontFamilyParamDescription;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].ParameterDisplayName = _fontFamilyParamDisplayName;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].ParameterName = _fontFamilyParamName;

                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[1] = new ParameterOutProperty();
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].Description = _fontColorParamDescription;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].ParameterDisplayName = _fontColorParamDisplayName;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].ParameterName = _fontColorParamName;

                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[2] = new ParameterOutProperty();
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].Description = _fontWeightParamDescription;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].ParameterDisplayName = _fontWeightParamDisplayName;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].ParameterName = _fontWeightParamName;

                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[3] = new ParameterOutProperty();
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].Description = _fontSizeParamDescription;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].ParameterDisplayName = _fontSizeParamDisplayName;
                    parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].ParameterName = _fontSizeParamName;

                    // Fire the ParametersOutProviderInit event.
                    ParametersOutProviderInit(this, parametersOutProviderInitInitEventArgs);
                }
            }
        }

        // Step #8: Override the PartCommunicationMain() method.
        // The PartCommunicationMain method is called by the Web Part 
        // infrastructure on the client during the ASP.NET PreRender
        // event to allow the part to pass its primary data to the 
        // other connected parts.
        // It is important to always fire either the ParametersOutReady 
        // or the NoParametersOut event. Some parts
        // may not behave properly if they are left waiting for this 
        // information.
        // ParametersOutReady should be fired to send the parameters.
        // NoParametersOut should be fired to indicate that there is no 
        // change in the parameters.
        
        public override void PartCommunicationMain()
        {
            // Ensure that all of the Web Part's controls are created.
            EnsureChildControls();

            // Check if connected.
            if(_connected)
            {
                // If there is a listener, fire the ParametersOutReady event.
                if(ParametersOutReady != null)
                {
                    // Need to create the ParametersOutReadyEventArgs 
                    // object for the ParametersOutReady event.
                    ParametersOutReadyEventArgs parametersOutReadyEventArgs = new ParametersOutReadyEventArgs();

                    if(_parametersReadyButtonClicked) //ParametersOutReady Button was clicked
                    {
                        // If there is a listener, fire the 
                        // ParametersOutReady event.
                        if(ParametersOutReady != null)
                        {
                            // Set the values to the values of the text
                            // boxes.
                            parametersOutReadyEventArgs.ParameterValues = new string[4];
                            parametersOutReadyEventArgs.ParameterValues[0] = _fontFamilyListBox.SelectedItem.Value;
                            parametersOutReadyEventArgs.ParameterValues[1] = _fontColorListBox.SelectedItem.Value;
                            parametersOutReadyEventArgs.ParameterValues[2] = _fontWeightListBox.SelectedItem.Value;
                            parametersOutReadyEventArgs.ParameterValues[3] = _fontSizeListBox.SelectedItem.Value;

                            // Fire the ParametersOutReady event.
                            ParametersOutReady(this, parametersOutReadyEventArgs);

                            _parametersReadyButtonClicked = false;
                        }
                    }
                    //The NoParametersOut button was clicked.
                    else if(_noParametersOutButtonClicked) 
                    {
                        // If there is a listener, fire the 
                        // NoParametersOut event.
                        if(NoParametersOut != null)
                        {
                            // Fire the event.
                            NoParametersOut(this, new EventArgs());

                            _noParametersOutButtonClicked = false;
                        }
                    }
                    // The user didn't click any button.
                    else 
                    {
                        // If there is a listener, fire the 
                        // NoParametersOut event.
                        if(NoParametersOut != null)
                        {
                            // Fire the event.
                            NoParametersOut(this, new EventArgs());

                            _noParametersOutButtonClicked = false;
                        }
                    }
                }
            }
        }

        // Step #9: Override the GetInitEventArgs method.
        // GetInitEventArgs() is called by the Web Part infrastructure 
        // during the ASP.NET PreRender event to gather the 
        // necessary information it needs to build the transformer 
        // dialog. The transformer dialog 
        // is needed when connecting different interfaces such as 
        // IRowProvider to ICellConsumer. The transformer dialog allows 
        // the user to map the fields between the 
        // interfaces. The GetInitEventArgs()method only needs to be 
        // implemented for interfaces that
        // can participate in a transformer which are the following:
        // ICellConsumer, IRowProvider, IFilterConsumer, 
        // IParametersOutProvider, IParametersInConsumer.
        // <param name="interfacename">Name of interface on which the 
        // Web Part infrastructure is requesting information</param>
        // <returns>An InitEventArgs object</returns>
        public override InitEventArgs GetInitEventArgs(string interfaceName)
        {
            // Check if this is my particular ParametersOut interface.
            if (interfaceName == "MyParametersOutProviderInterface")
            {
                // Ensure that child controls have been created
                EnsureChildControls();

                // Need to create the 
                // ParametersOutProviderInitEventArgs object for the 
                // ParametersOutProviderInit event.
                ParametersOutProviderInitEventArgs parametersOutProviderInitInitEventArgs = new ParametersOutProviderInitEventArgs();
                    
                // Set the ParameterOutProperties.
                parametersOutProviderInitInitEventArgs.ParameterOutProperties = new ParameterOutProperty[4];

                //There are 4 parameters types that will be passed: 
                // Font Family, Color, Weight, and Size
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[0] = new ParameterOutProperty();
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].Description = _fontFamilyParamDescription;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].ParameterDisplayName = _fontFamilyParamDisplayName;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[0].ParameterName = _fontFamilyParamName;

                parametersOutProviderInitInitEventArgs.ParameterOutProperties[1] = new ParameterOutProperty();
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].Description = _fontColorParamDescription;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].ParameterDisplayName = _fontColorParamDisplayName;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[1].ParameterName = _fontColorParamName;

                parametersOutProviderInitInitEventArgs.ParameterOutProperties[2] = new ParameterOutProperty();
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].Description = _fontWeightParamDescription;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].ParameterDisplayName = _fontWeightParamDisplayName;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[2].ParameterName = _fontWeightParamName;

                parametersOutProviderInitInitEventArgs.ParameterOutProperties[3] = new ParameterOutProperty();
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].Description = _fontSizeParamDescription;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].ParameterDisplayName = _fontSizeParamDisplayName;
                parametersOutProviderInitInitEventArgs.ParameterOutProperties[3].ParameterName = _fontSizeParamName;
                    
                // Return the parametersOutProviderInitInitEventArgs 
                // object.
                return(parametersOutProviderInitInitEventArgs);
            }
            else
            {
                return(null);
            }
        }

        protected override void RenderWebPart(HtmlTextWriter output)
        {
            // Check for connection interface registration error.
            if (_registrationErrorOccurred)
            {
                output.Write(_registrationErrorMsg);
                return;
            }

            // Ensure that all of the Web Part's controls are created.
            EnsureChildControls();

            // Check if connected.
            if(_connected)
            {
                // Render List Box table.
                output.RenderBeginTag(HtmlTextWriterTag.Table); //Begin Table

                // Font Family Row.
                output.RenderBeginTag(HtmlTextWriterTag.Tr);    //Begin TR
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                output.RenderBeginTag(HtmlTextWriterTag.B);        //Begin B
                output.Write(_fontFamilyParamDisplayName + ": ");    //Render List Box Label
                output.RenderEndTag();                            //End </B>
                output.RenderEndTag();                            //End </TD>
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                _fontFamilyListBox.RenderControl(output);        //Render list box
                output.RenderEndTag();                            //End </TD>
                output.RenderEndTag();                            //End </TR>

                // Font Color Row.
                output.RenderBeginTag(HtmlTextWriterTag.Tr);    //Begin TR
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                output.RenderBeginTag(HtmlTextWriterTag.B);        //Begin B
                output.Write(_fontColorParamDisplayName + ": ");    //Render List Box Label
                output.RenderEndTag();                            //End </B>
                output.RenderEndTag();                            //End </TD>
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                _fontColorListBox.RenderControl(output);        //Render list box
                output.RenderEndTag();                            //End </TD>
                output.RenderEndTag();                            //End </TR>

                // Font Weight Row.
                output.RenderBeginTag(HtmlTextWriterTag.Tr);    //Begin TR
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                output.RenderBeginTag(HtmlTextWriterTag.B);        //Begin B
                output.Write(_fontWeightParamDisplayName + ": ");    //Render List Box Label
                output.RenderEndTag();                            //End </B>
                output.RenderEndTag();                            //End </TD>
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                _fontWeightListBox.RenderControl(output);        //Render list box
                output.RenderEndTag();                            //End </TD>
                output.RenderEndTag();                            //End </TR>

                // Font Size Row.
                output.RenderBeginTag(HtmlTextWriterTag.Tr);    //Begin TR
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                output.RenderBeginTag(HtmlTextWriterTag.B);        //Begin B
                output.Write(_fontSizeParamDisplayName + ": ");    //Render List Box Label
                output.RenderEndTag();                            //End </B>
                output.RenderEndTag();                            //End </TD>
                output.RenderBeginTag(HtmlTextWriterTag.Td);    //Begin TD
                _fontSizeListBox.RenderControl(output);        //Render list box
                output.RenderEndTag();                            //End </TD>
                output.RenderEndTag();                            //End </TR>

                output.RenderEndTag();                            //End <Table>

                
                // Render buttons.
                _parametersReadyButton.RenderControl(output);
                _noParametersOutButton.RenderControl(output);

                // Line break.
                output.RenderBeginTag(HtmlTextWriterTag.Br);
                output.RenderEndTag();

                // Render connected Web Part title.
                output.Write(_connectedWebPartLabel + ": ");
                output.RenderBeginTag(HtmlTextWriterTag.I);
                output.Write(_connectedWebPartTitle);
                output.RenderEndTag();

            }
            else
            {
                // The Web Part isn't connected.
                output.Write(_notConnectedMsg);
            }

        }

        // Create Web Part user interface controls.
        protected override void CreateChildControls()
        {
            // Create List Boxes.
            _fontFamilyListBox = new DropDownList();
            _fontColorListBox = new DropDownList();
            _fontWeightListBox = new DropDownList();
            _fontSizeListBox = new DropDownList();

            // Set List Box IDs.
            _fontFamilyListBox.ID = "FontFamilyListBox";
            _fontColorListBox.ID = "FontColorListBox";
            _fontWeightListBox.ID = "FontWeightListBox";
            _fontSizeListBox.ID = "FontSizeListBox";

            // Set List Box Values.
            _fontFamilyListBox.DataSource = _fontFamilyArrayList;
            _fontColorListBox.DataSource = _fontColorArrayList;
            _fontWeightListBox.DataSource = _fontWeightArrayList;
            _fontSizeListBox.DataSource = _fontSizeArrayList;

            // Databind the List Boxes.
            _fontFamilyListBox.DataBind();
            _fontColorListBox.DataBind();
            _fontWeightListBox.DataBind();
            _fontSizeListBox.DataBind();

            // Add List Boxes to Controls Collection.
            Controls.Add(_fontFamilyListBox);
            Controls.Add(_fontColorListBox);
            Controls.Add(_fontWeightListBox);
            Controls.Add(_fontSizeListBox);

            // Create the ParametersOutReady button.
            _parametersReadyButton = new Button();
            _parametersReadyButton.ID = "ParametersOutReadyButton";
            _parametersReadyButton.Text = "Fire ParametersOutReady";
            Controls.Add(_parametersReadyButton);

            // Create the NoParametersOut button.
            _noParametersOutButton = new Button();
            _noParametersOutButton.ID = "NoParametersOutButton";
            _noParametersOutButton.Text = "Fire NoParametersOut";
            Controls.Add(_noParametersOutButton);


            // Hook up button clicks.
            _parametersReadyButtonClicked = false; // Initialize to false -- user hasn't clicked yet
            _parametersReadyButton.Click += new EventHandler(ParametersOutReadyButtonClicked); // listen for Button's click event

            _noParametersOutButtonClicked = false; // Initialize to false -- user hasn't clicked yet
            _noParametersOutButton.Click += new EventHandler(NoParametersOutButtonClicked); // listen for Button's click event
        }

        // The ParametersOutReadyButton OnClick event handler.
        // <param name="sender">The Button object</param>
        // <param name="e">The Event Arguments</param>
        private void ParametersOutReadyButtonClicked(object sender, EventArgs e)
        {
            _parametersReadyButtonClicked = true; //user clicked button, set to true
        }

        
        // The NoParametersOutButton OnClick event handler.
        // <param name="sender">The Button object</param>
        // <param name="e">The Event Arguments</param>
        private void NoParametersOutButtonClicked(object sender, EventArgs e)
        {
            _noParametersOutButtonClicked = true; //user clicked button, set to true
        }
    }
}

See Also

Reference

IParametersOutProvider Members

Microsoft.SharePoint.WebPartPages.Communication Namespace