Export (0) Print
Expand All

ListReadyEventArgs class

NOTE: This API is now obsolete.

Provides the list of data to the ListReadyevent of the IListProviderinterface.

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

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

[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartTable instead")]
public class ListReadyEventArgs : EventArgs

The following code example shows an overridden WebPart.PartCommunicationMainmethod that creates an instance of the ListReadyEventArgs class to send when the ListReady event occurs. This code example is part of a larger example provided for the IListProvider 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 ListReady or PartialListReady 
// event. Some parts may not behave properly if they are left waiting 
// for this information.
public override void PartCommunicationMain()
{
    // Ensure that all of the Web Part's controls are created.
    EnsureChildControls();

    // Check if connected
    if(_connected)
    {
        // If there is a listener, fire the ListReady event.
        if (ListReady != null)
        {
            // Create the ListReadyEventArgs object for the 
            // ListProviderInit event.
            ListReadyEventArgs listReadyArgs = new ListReadyEventArgs();

            // If user clicked button, send the value.
            if (_listButtonClicked)
            {
                // Set the List to the value of the table in the 
                // DataGrid.
                // This is the value that will be sent to the consumer 
                // Web Part.
                listReadyArgs.List = ((DataTable)_dataGrid.DataSource);
            }
            else
            {
                // The user didn't click the button, so send a
                // null DataTable to the consumer Web Part.
                listReadyArgs.List = null;
            }

            // Fire the ListReady event.
            // The consumer Web Part will receive the DataTable.
            ListReady(this, listReadyArgs);
        }
    }
}

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

Community Additions

ADD
Show:
© 2014 Microsoft