Share via


InitEventArgs-Klasse

HINWEIS: Diese API ist veraltet.

Stellt den von der WebPart.GetInitEventArgs -Methode zurückgegebenen Objekttyp an.

Vererbungshierarchie

System.Object
  System.EventArgs
    Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.CellConsumerInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.CellProviderInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.FilterConsumerInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.ListProviderInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.ParametersInConsumerInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.ParametersOutProviderInitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.RowProviderInitEventArgs

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

Syntax

'Declaration
<ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")> _
Public Class InitEventArgs _
    Inherits EventArgs
'Usage
Dim instance As InitEventArgs
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
public class InitEventArgs : EventArgs

Beispiele

Das folgende Codebeispiel zeigt eine überschriebene GetInitEventArgs -Methode, die eine Instanz der Klasse InitEventArgs zurückgibt. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IFilterConsumer -Schnittstelle.

' Step #8: 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 cell interface.
   If interfaceName = "MyFilterConsumerInterface" Then
      'Ensure that all of the Web Part's controls are created.
      'The _filterFieldNames and _filterFieldDisplayNames are set during EnsureChildControls()
      EnsureChildControls()
          
      ' Create the FilterConsumerInitEventArgs object for the FilterConsumerInit event.
      Dim filterConsumerInitArgs As New FilterConsumerInitEventArgs()
            
      ' Set the field names
      filterConsumerInitArgs.FieldList = _filterFieldNames
      filterConsumerInitArgs.FieldDisplayList = _filterFieldDisplayNames
            
      ' return the FilterConsumerInitEventArgs. 
      Return filterConsumerInitArgs
   Else
      Return Nothing
   End If
End Function
// Step #8: 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 cell interface.
    if (interfaceName == "MyFilterConsumerInterface")
    {
        //Ensure that all of the Web Part's controls are created.
        //The _filterFieldNames and _filterFieldDisplayNames are set 
        //during EnsureChildControls()
        EnsureChildControls();

        // Create the FilterConsumerInitEventArgs object for the 
        // FilterConsumerInit event.
        FilterConsumerInitEventArgs filterConsumerInitArgs = new FilterConsumerInitEventArgs();
                    
        // Set the field names
        filterConsumerInitArgs.FieldList = _filterFieldNames;
        filterConsumerInitArgs.FieldDisplayList = _filterFieldDisplayNames;
            
        // return the FilterConsumerInitEventArgs. 
        return(filterConsumerInitArgs);
    }
    else
    {
        return(null);
    }
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.

Siehe auch

Referenz

InitEventArgs-Member

Microsoft.SharePoint.WebPartPages.Communication-Namespace