Freigeben über


IParametersInProvider.NoParametersIn-Ereignis

HINWEIS: Diese API ist veraltet.

Tritt auf, wenn keine Parameterliste verfügbar, an die Consumer-Webpart gesendet werden vorhanden ist.

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event NoParametersIn As NoParametersInEventHandler
'Usage
Dim instance As IParametersInProvider
Dim handler As NoParametersInEventHandler

AddHandler instance.NoParametersIn, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event NoParametersInEventHandler NoParametersIn

Hinweise

Ein Webpart, das die IParametersInProvider -Schnittstelle implementiert sollte immer die ParametersInReady oder das NoParametersIn -Ereignis ausgelöst. Einige Webparts Verhalten möglicherweise nicht ordnungsgemäß, wenn sie keine dieser Informationen erhalten. Lösen Sie das ParametersInReady -Ereignis, um die Parameter zu senden. Lösen Sie das NoParametersIn -Ereignis, um darauf hinzuweisen, dass keine in den Parametern Änderung.

Beispiele

Das folgende Codebeispiel zeigt eine überschriebene PartCommunicationMain -Methode, die das NoParametersIn -Ereignis wird ausgelöst. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IParametersInProvider -Schnittstelle.

      Public Overrides Sub PartCommunicationMain()
            ' Ensure that all of the Web Part's controls are created.
            EnsureChildControls()

            'Check if connected
            If _connected Then
                ' Create the ParametersInReadyEventArgs object for the ParametersInReady event.
                Dim parametersInReadyEventArgs As New ParametersInReadyEventArgs()

                If _parametersReadyButtonClicked Then 'ParametersInReady Button was clicked

                    ' Set the parameter values to the text box values.
                    If Not (_fieldList Is Nothing) Then
                        parametersInReadyEventArgs.ParameterValues = New String(_fieldList.Length) {}

                        Dim index As Integer
                        For index = 0 To _fieldList.Length - 1
                            parametersInReadyEventArgs.ParameterValues(index) = _fontAttributeTextBox(index).Text
                        Next index

                        ' Fire the ParametersInReady event.
                        RaiseEvent ParametersInReady(Me, parametersInReadyEventArgs)
                        '_fieldList is null
                    Else
                        ' Fire the event.
                        RaiseEvent NoParametersIn(Me, New EventArgs())
                    End If
                    _parametersReadyButtonClicked = False
                ElseIf _noParametersInButtonClicked Then 'NoParametersIn Button was clicked                       
                    ' Fire the NoParametersIn event.
                    RaiseEvent NoParametersIn(Me, New EventArgs())
                    _noParametersInButtonClicked = False
                End If
            End If
        End Sub
// Step #7: Implement 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 ParametersInReady or the 
// NoParametersIn event. Some parts
// may not behave properly if they are left waiting for this 
// information.
// ParametersInReady should be fired to send the parameters.
// NoParametersIn 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 ParametersInReady event.
        if(ParametersInReady != null)
        {
            // Create the ParametersInReadyEventArgs object for the ParametersInReady event.
            ParametersInReadyEventArgs parametersInReadyEventArgs = new ParametersInReadyEventArgs();

            if(_parametersReadyButtonClicked) //ParametersInReady Button was clicked
            {
                // If there is a listener, fire the ParametersInReady 
                // event.
                if(ParametersInReady != null)
                {
                    // Set the parameter values to the text box values.
                    if (_fieldList != null)
                    {
                        parametersInReadyEventArgs.ParameterValues = new string[_fieldList.Length];

                        for (int index = 0; index < _fieldList.Length; index++)
                        {
                            parametersInReadyEventArgs.ParameterValues[index] = _fontAttributeTextBox[index].Text;
                        }

                        // Fire the ParametersInReady event.
                        ParametersInReady(this, parametersInReadyEventArgs);
                    }
                    else //_fieldList is null
                    {
                        // If there is a listener, fire the NoParametersIn event.
                        if(NoParametersIn != null)
                        {
                            // Fire the event.
                            NoParametersIn(this, new EventArgs());
                        }
                    }
                    _parametersReadyButtonClicked = false;
                }
            }
            else if(_noParametersInButtonClicked) //NoParametersIn Button was clicked
            {
                // If there is a listener, fire the NoParametersIn 
                // event.
                if(NoParametersIn != null)
                {
                    // Fire the NoParametersIn event.
                    NoParametersIn(this, new EventArgs());

                    _noParametersInButtonClicked = false;
                }
            }
        }
    }
}

Siehe auch

Referenz

IParametersInProvider Schnittstelle

IParametersInProvider-Member

Microsoft.SharePoint.WebPartPages.Communication-Namespace