共用方式為


IRowProvider.RowProviderInit event

NOTE: This API is now obsolete.

在提供的資料列中,會傳送名稱和欄位的顯示名稱。

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

Syntax

'宣告
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")> _
Event RowProviderInit As RowProviderInitEventHandler
'用途
Dim instance As IRowProvider
Dim handler As RowProviderInitEventHandler

AddHandler instance.RowProviderInit, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")]
event RowProviderInitEventHandler RowProviderInit

備註

事件處理常式會接收包含與這個事件相關的資料型別Microsoft.SharePoint.WebPartPages.Communication.RowProviderInitEventArgs的引數。RowProviderInitEventArgs 屬性FieldListFieldDisplayList提供這個事件的特定資訊。

Examples

下列程式碼範例示範覆寫的WebPart.PartCommunicationInit方法會建立RowProviderInitEventArgs的物件,設定欄位名稱和顯示名稱,然後再引發RowProviderInit事件。這個程式碼範例是提供IRowProvider介面的完整範例的一部分。

      ' 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);
                }
            }
        }

請參閱

參照

IRowProvider interface

IRowProvider members

Microsoft.SharePoint.WebPartPages.Communication namespace