Share via


RowReadyEventArgs.Rows Property

NOTE: This API is now obsolete.

Gets or sets the selected or updated rows to send when the RowReady event occurs in a Web Part that implements the IRowProvider interface.

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

Syntax

<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartRow instead")> _
Public Property Rows As DataRow()
    Get
    Set

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

Property Value

Type: []
An array of strings containing the selected or updated rows.

Examples

The following code example shows an overridden WebPart.PartCommunicationMain method that creates a RowReadyEventArgs object, sets the row values and selection status, and then fires the RowReady event. This code example is part of a larger example provided for the IRowProvider interface.

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

See Also

Reference

RowReadyEventArgs Class

RowReadyEventArgs Members

Microsoft.SharePoint.WebPartPages.Communication Namespace