Partilhar via


RowProviderInitEventArgs Class

NOTE: This API is now obsolete.

Provides the field names and optional field display names for the row provided by a Web Part that implements the [T][:Microsoft.SharePoint.WebPartPages.Communication.IRowProvider] interface when the RowProviderInit event occurs.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
      Microsoft.SharePoint.WebPartPages.Communication.RowProviderInitEventArgs

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

Syntax

'Declaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")> _
Public NotInheritable Class RowProviderInitEventArgs _
    Inherits InitEventArgs
'Usage
Dim instance As RowProviderInitEventArgs
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")]
public sealed class RowProviderInitEventArgs : InitEventArgs

Examples

The following code example shows an overridden WebPart.PartCommunicationInit method that creates a RowProviderInitEventArgs object, sets field names and display names, and then fires the RowProviderInit event. This code example is part of a larger example provided for the Microsoft.SharePoint.WebPartPages.Communication.IRowProvider interface.

      ' Step #7: Override the PartCommunicationInit() method.
      ' The PartCommunicationInit method is called by the Web Part infrastructure during the ASP.NET PreRender 
      ' event 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
                ' Create the RowProviderInitEventArgs object for the RowProviderInit event.
                Dim rowProviderInitEventArgs As New RowProviderInitEventArgs()

                ' Set the row field names.
                rowProviderInitEventArgs.FieldList = _rowFieldNames

                ' Set the row field display names.
                rowProviderInitEventArgs.FieldDisplayList = _rowFieldDisplayNames

                ' Fire the RowProviderInit event.
                RaiseEvent RowProviderInit(Me, rowProviderInitEventArgs)
            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 
        // event 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 RowProviderInit event.
                if (RowProviderInit != null)
                {
                    // Create the RowProviderInitEventArgs object for the RowProviderInit event.
                    RowProviderInitEventArgs rowProviderInitEventArgs = new RowProviderInitEventArgs();
                    
                    // Set the row field names.
                    rowProviderInitEventArgs.FieldList = _rowFieldNames;

                    // Set the row field display names.
                    rowProviderInitEventArgs.FieldDisplayList = _rowFieldDisplayNames;

                    // Fire the RowProviderInit event.
                    RowProviderInit(this, rowProviderInitEventArgs);
                }
            }
        }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

RowProviderInitEventArgs Members

Microsoft.SharePoint.WebPartPages.Communication Namespace