Поделиться через


Класс RowReadyEventArgs

Примечание. Этот API устарел.

Предоставляет текущее значение строки из веб-части, который реализует интерфейс IRowProvider при возникновении события RowReady .

Иерархия наследования

System.Object
  System.EventArgs
    Microsoft.SharePoint.WebPartPages.Communication.RowReadyEventArgs

Пространство имен:  Microsoft.SharePoint.WebPartPages.Communication
Сборка:  Microsoft.SharePoint (в Microsoft.SharePoint.dll)

Синтаксис

'Декларация
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")> _
Public Class RowReadyEventArgs _
    Inherits EventArgs
'Применение
Dim instance As RowReadyEventArgs
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")]
public class RowReadyEventArgs : EventArgs

Примеры

В следующем примере кода показан метод переопределенный WebPart.PartCommunicationMain , которая создает объект RowReadyEventArgs , задает значения строк и состояние выбора и затем запускает событие RowReady . Этот пример кода является частью большего примера для интерфейса IRowProvider .

      ' Step #8: Override 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 the RowReady event. Some parts
      ' may not behave properly if they are left waiting for this 
      ' information.
      Public Overrides Sub PartCommunicationMain()
         ' Check if connected.
         If _connected Then
            'If there is a listener, fire the RowReady event.
            If Not (RowReady Is Nothing) Then
               ' Create the RowReadyEventArgs object for the RowReady 
               ' event.
               Dim rowReadyEventArgs As New RowReadyEventArgs()
               
               ' Declare data variables.
               Dim selectionStatus As String = ""
               Dim dr(0) As DataRow
               
               ' If a row is selected, send the row.
               If _dataGrid.SelectedIndex > - 1 Then
                  ' Generate an array containing the selected 
                  ' DataRow(s).
                  dr(0) = CType(_dataGrid.DataSource, DataTable).Rows(_dataGrid.SelectedIndex)
                  
                  ' Set the selection status.
                  selectionStatus = "Standard"
               
               Else
                  ' The user hasn't selected a row so send null.
                  dr(0) = Nothing
                  
                  ' Set the selection status.
                  selectionStatus = "None"
               End If
               
               ' Set values.
               rowReadyEventArgs.Rows = dr
               rowReadyEventArgs.SelectionStatus = selectionStatus
               
               ' Fire the RowReady event.
               RaiseEvent RowReady(Me, rowReadyEventArgs)
            End If
         End If
      End Sub
        // Step #8: Override 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 the RowReady event. Some 
        // parts may not behave properly if they are left waiting for 
        // this information.
        public override void PartCommunicationMain()
        {
            // Check if connected.
            if(_connected)
            {
                //If there is a listener, fire the RowReady event.
                if (RowReady != null)
                {
                    // Create the RowReadyEventArgs object for the 
                    // RowReady event.
                    RowReadyEventArgs rowReadyEventArgs = new RowReadyEventArgs();

                    // Declare data variables.
                    string selectionStatus = "";
                    DataRow[] dr = new DataRow[1];

                    // If a row is selected, send the row.
                    if ( _dataGrid.SelectedIndex > -1)
                    {
                        // Generate an array containing the selected 
                        // DataRow(s).
                        dr[0] = ((DataTable)_dataGrid.DataSource).Rows[_dataGrid.SelectedIndex];
                    
                        // Set the selection status.
                        selectionStatus = "Standard";

                    }
                    else
                    {
                        // The user hasn't selected a row so send null.
                        dr[0] = null;

                        // Set the selection status.
                        selectionStatus = "None";
                    }

                    // Set values
                    rowReadyEventArgs.Rows = dr;
                    rowReadyEventArgs.SelectionStatus = selectionStatus;

                    // Fire the RowReady event.
                    RowReady(this, rowReadyEventArgs);
                }
            }
        }

Потокобезопасность

Любые общедоступные элементы static (Shared в Visual Basic) этого типа являются потокобезопасными. Не гарантируется, что любые элементы экземпляров потокобезопасны.

См. также

Справочные материалы

Элементы RowReadyEventArgs

Пространство имен Microsoft.SharePoint.WebPartPages.Communication