Compartilhar via


ParameterInProperty.ParameterName Property

NOTE: This API is now obsolete.

Gets or sets the name of a parameter provided by a Web Part that implements the IParametersInConsumerinterface when the ParametersInConsumerInit event occurs.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Public Property ParameterName As String
    Get
    Set
'Usage
Dim instance As ParameterInProperty
Dim value As String

value = instance.ParameterName

instance.ParameterName = value
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
public string ParameterName { get; set; }

Property Value

Type: System.String
The name of the parameter. The ParameterName property is a unique identifier for a parameter. It is displayed in the user interface if the ParameterDisplayName is not given.

Examples

The following code example shows an overridden WebPart.PartCommunicationInitmethod that sets the ParameterName property of an instance of the ParameterInPropertyclass. This code example is part of a larger example provided for the IParametersInConsumer interface.

// 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 all controls have been created.
    EnsureChildControls();

    // Check if connected.
    if(_connected)
    {
       
            // Need to create the ParametersInConsumerInitEventArgs 
            // object for the ParametersInConsumerInit event.
            ParametersInConsumerInitEventArgs parametersInConsumerInitEventArgs = new ParametersInConsumerInitEventArgs();
    
            // Set the ParameterInProperties.
            parametersInConsumerInitEventArgs.ParameterInProperties = new ParameterInProperty[4];

            parametersInConsumerInitEventArgs.ParameterInProperties[0] = new ParameterInProperty();
            parametersInConsumerInitEventArgs.ParameterInProperties[0].Description = _fontFamilyParamDescription;
            parametersInConsumerInitEventArgs.ParameterInProperties[0].ParameterDisplayName = _fontFamilyParamDisplayName;
            parametersInConsumerInitEventArgs.ParameterInProperties[0].ParameterName = _fontFamilyParamName;
            parametersInConsumerInitEventArgs.ParameterInProperties[0].Required = true;

            parametersInConsumerInitEventArgs.ParameterInProperties[1] = new ParameterInProperty();
            parametersInConsumerInitEventArgs.ParameterInProperties[1].Description = _fontColorParamDescription;
            parametersInConsumerInitEventArgs.ParameterInProperties[1].ParameterDisplayName = _fontColorParamDisplayName;
            parametersInConsumerInitEventArgs.ParameterInProperties[1].ParameterName = _fontColorParamName;
            parametersInConsumerInitEventArgs.ParameterInProperties[1].Required = false;

            parametersInConsumerInitEventArgs.ParameterInProperties[2] = new ParameterInProperty();
            parametersInConsumerInitEventArgs.ParameterInProperties[2].Description = _fontWeightParamDescription;
            parametersInConsumerInitEventArgs.ParameterInProperties[2].ParameterDisplayName = _fontWeightParamDisplayName;
            parametersInConsumerInitEventArgs.ParameterInProperties[2].ParameterName = _fontWeightParamName;
            parametersInConsumerInitEventArgs.ParameterInProperties[2].Required = true;

            parametersInConsumerInitEventArgs.ParameterInProperties[3] = new ParameterInProperty();
            parametersInConsumerInitEventArgs.ParameterInProperties[3].Description = _fontSizeParamDescription;
            parametersInConsumerInitEventArgs.ParameterInProperties[3].ParameterDisplayName = _fontSizeParamDisplayName;
            parametersInConsumerInitEventArgs.ParameterInProperties[3].ParameterName = _fontSizeParamName;
            parametersInConsumerInitEventArgs.ParameterInProperties[3].Required = false;

            // Fire the ParametersInConsumerInit event.
            ParametersInConsumerInit(this, parametersInConsumerInitEventArgs);
        
    }
}
' 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 all controls have been created.
        EnsureChildControls()

        ' Check if connected.
        If _connected Then

                        ' Need to create the ParametersInConsumerInitEventArgs 
                        ' object for the ParametersInConsumerInit event.
                        Dim parametersInConsumerInitEventArgs As New ParametersInConsumerInitEventArgs()

                        ' Set the ParameterInProperties.
                        parametersInConsumerInitEventArgs.ParameterInProperties = New ParameterInProperty(3){}

                        parametersInConsumerInitEventArgs.ParameterInProperties(0) = New ParameterInProperty()
                        parametersInConsumerInitEventArgs.ParameterInProperties(0).Description = _fontFamilyParamDescription
                        parametersInConsumerInitEventArgs.ParameterInProperties(0).ParameterDisplayName = _fontFamilyParamDisplayName
                        parametersInConsumerInitEventArgs.ParameterInProperties(0).ParameterName = _fontFamilyParamName
                        parametersInConsumerInitEventArgs.ParameterInProperties(0).Required = True

                        parametersInConsumerInitEventArgs.ParameterInProperties(1) = New ParameterInProperty()
                        parametersInConsumerInitEventArgs.ParameterInProperties(1).Description = _fontColorParamDescription
                        parametersInConsumerInitEventArgs.ParameterInProperties(1).ParameterDisplayName = _fontColorParamDisplayName
                        parametersInConsumerInitEventArgs.ParameterInProperties(1).ParameterName = _fontColorParamName
                        parametersInConsumerInitEventArgs.ParameterInProperties(1).Required = False

                        parametersInConsumerInitEventArgs.ParameterInProperties(2) = New ParameterInProperty()
                        parametersInConsumerInitEventArgs.ParameterInProperties(2).Description = _fontWeightParamDescription
                        parametersInConsumerInitEventArgs.ParameterInProperties(2).ParameterDisplayName = _fontWeightParamDisplayName
                        parametersInConsumerInitEventArgs.ParameterInProperties(2).ParameterName = _fontWeightParamName
                        parametersInConsumerInitEventArgs.ParameterInProperties(2).Required = True

                        parametersInConsumerInitEventArgs.ParameterInProperties(3) = New ParameterInProperty()
                        parametersInConsumerInitEventArgs.ParameterInProperties(3).Description = _fontSizeParamDescription
                        parametersInConsumerInitEventArgs.ParameterInProperties(3).ParameterDisplayName = _fontSizeParamDisplayName
                        parametersInConsumerInitEventArgs.ParameterInProperties(3).ParameterName = _fontSizeParamName
                        parametersInConsumerInitEventArgs.ParameterInProperties(3).Required = False

                        ' Fire the ParametersInConsumerInit event.
                        RaiseEvent ParametersInConsumerInit(Me, parametersInConsumerInitEventArgs)

        End If
End Sub

See Also

Reference

ParameterInProperty Class

ParameterInProperty Members

Microsoft.SharePoint.WebPartPages.Communication Namespace