Share via


de la propiedad RowReadyEventArgs.Rows

NOTA: esta API está ahora obsoleta.

Obtiene o establece las filas seleccionadas o actualizadas para enviar cuando se produce el evento RowReady en un elemento Web que implementa la interfaz IRowProvider .

Espacio de nombres:  Microsoft.SharePoint.WebPartPages.Communication
Ensamblado:  Microsoft.SharePoint (en Microsoft.SharePoint.dll)

Sintaxis

'Declaración
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")> _
Public Property Rows As DataRow()
    Get
    Set
'Uso
Dim instance As RowReadyEventArgs
Dim value As DataRow()

value = instance.Rows

instance.Rows = value
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")]
public DataRow[] Rows { get; set; }

Valor de propiedad

Tipo: []
Una matriz de cadenas que contiene las filas seleccionadas o actualizadas.

Ejemplos

En el ejemplo de código siguiente se muestra un método invalidado WebPart.PartCommunicationMain que crea un objeto RowReadyEventArgs , se establece los valores de fila y el estado de selección y, a continuación, se desencadena el evento RowReady . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz 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 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 selection status.
                        selectionStatus = "None";
                    }

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

                    // Fire the RowReady event.
                    RowReady(this, rowReadyEventArgs);
                }
            }
        }
        ' 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 RowReady IsNot 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 selection status.
                        selectionStatus = "None"
                    End If

                    ' Set Values
                    rowReadyEventArgs.Rows = dr
                    rowReadyEventArgs.SelectionStatus = selectionStatus

                    ' Fire the RowReady event.
                    RaisEvent RowReady(Me, rowReadyEventArgs)
                End If
            End If
        End Sub

Vea también

Referencia

clase RowReadyEventArgs

Miembros RowReadyEventArgs

Espacio de nombres Microsoft.SharePoint.WebPartPages.Communication