IParametersOutProvider.ParametersOutReady - Événement
Remarque : cette API est désormais obsolète.
Se produit lorsque la liste de paramètres est prête à être envoyée au composant WebPart consommateur à partir d'un fournisseur de composant qui implémente l'interface IParametersOutProvider . Sur l'ordinateur client, il peut survenir à tout moment ; Toutefois, il est généralement déclenché lorsqu'un paramètre est mis à jour ou sélectionné. Sur le serveur, il doit être levé dans la méthodede WebPart.PartCommunicationMain.
Espace de noms : Microsoft.SharePoint.WebPartPages.Communication
Assembly : Microsoft.SharePoint (dans Microsoft.SharePoint.dll)
Syntaxe
'Déclaration
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event ParametersOutReady As ParametersOutReadyEventHandler
'Utilisation
Dim instance As IParametersOutProvider
Dim handler As ParametersOutReadyEventHandler
AddHandler instance.ParametersOutReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event ParametersOutReadyEventHandler ParametersOutReady
Remarques
Le Gestionnaire d'événements reçoit un argument de type Microsoft.SharePoint.WebPartPages.Communication.ParametersOutReadyEventArgs contenant des données liées à cet événement. Cette classe fournit un tableau de chaînes dans sa propriété ParameterValues . Chaque chaîne du tableau est une valeur d'un paramètre. Le nombre et l'ordre des paramètres contenus dans ce tableau doivent correspondre à ceux spécifiés par l'argument Microsoft.SharePoint.WebPartPages.Communication.ParametersOutProviderInitEventArgs de la méthode ParametersOutProviderInit .
Un composant qui implémente l'interface IParametersOutProvider doit toujours déclencher l'événement NoParametersOut ou le ParametersOutReady . Certains WebParts peut se comporter correctement si elles ne reçoivent pas ces informations. Déclenche l'événement ParametersOutReady pour envoyer les paramètres. Déclenche l'événement NoParametersOut pour indiquer qu'il n'y a aucun changement dans les paramètres.
Exemples
L'exemple de code suivant montre une méthode substituée PartCommunicationsMain qui déclenche l'événement ParametersOutReady . Cet exemple de code fait partie d'un exemple plus développé fourni pour l'interface IParametersOutProvider .
' 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 either the ParametersOutReady or
' the NoParametersOut event. Some parts
' may not behave properly if they are left waiting for this
' information. ParametersOutReady should be fired to send the
' parameters. NoParametersOut should be fired to indicate that
' there is no change in the parameters.
Public Overrides Sub PartCommunicationMain()
' Ensure that all of the Web Part's controls are created.
EnsureChildControls()
' Check if connected.
If _connected Then
' Need to create the ParametersOutReadyEventArgs object
' for the ParametersOutReady event.
Dim parametersOutReadyEventArgs As New ParametersOutReadyEventArgs()
If _parametersReadyButtonClicked Then 'ParametersOutReady Button was clicked
' Set the values to the values of the text boxes.
parametersOutReadyEventArgs.ParameterValues = New String(3) {}
parametersOutReadyEventArgs.ParameterValues(0) = _fontFamilyListBox.SelectedItem.Value
parametersOutReadyEventArgs.ParameterValues(1) = _fontColorListBox.SelectedItem.Value
parametersOutReadyEventArgs.ParameterValues(2) = _fontWeightListBox.SelectedItem.Value
parametersOutReadyEventArgs.ParameterValues(3) = _fontSizeListBox.SelectedItem.Value
' Fire the ParametersOutReady event.
RaiseEvent ParametersOutReady(Me, parametersOutReadyEventArgs)
_parametersReadyButtonClicked = False
'The NoParametersOut button was clicked.
ElseIf _noParametersOutButtonClicked Then
' Fire the event.
RaiseEvent NoParametersOut(Me, New EventArgs())
_noParametersOutButtonClicked = False
' The user didn't click any button.
Else
' Fire the event.
RaiseEvent NoParametersOut(Me, New EventArgs())
_noParametersOutButtonClicked = False
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 either the
// ParametersOutReady or the NoParametersOut event. Some parts
// may not behave properly if they are left waiting for this
// information. ParametersOutReady should be fired to send the
// parameters. NoParametersOut should be fired to indicate that there
// is no change in the parameters.
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 ParametersOutReady event.
if(ParametersOutReady != null)
{
// Need to create the ParametersOutReadyEventArgs object
// for the ParametersOutReady event.
ParametersOutReadyEventArgs parametersOutReadyEventArgs = new ParametersOutReadyEventArgs();
if(_parametersReadyButtonClicked) //ParametersOutReady Button was clicked
{
// If there is a listener, fire the ParametersOutReady
// event.
if(ParametersOutReady != null)
{
// Set the values to the values of the text
// boxes.
parametersOutReadyEventArgs.ParameterValues = new string[4];
parametersOutReadyEventArgs.ParameterValues[0] = _fontFamilyListBox.SelectedItem.Value;
parametersOutReadyEventArgs.ParameterValues[1] = _fontColorListBox.SelectedItem.Value;
parametersOutReadyEventArgs.ParameterValues[2] = _fontWeightListBox.SelectedItem.Value;
parametersOutReadyEventArgs.ParameterValues[3] = _fontSizeListBox.SelectedItem.Value;
// Fire the ParametersOutReady event.
ParametersOutReady(this, parametersOutReadyEventArgs);
_parametersReadyButtonClicked = false;
}
}
//The NoParametersOut button was clicked.
else if(_noParametersOutButtonClicked)
{
// If there is a listener, fire the NoParametersOut
// event.
if(NoParametersOut != null)
{
// Fire the event.
NoParametersOut(this, new EventArgs());
_noParametersOutButtonClicked = false;
}
}
// The user didn't click any button.
else
{
// If there is a listener, fire the NoParametersOut
// event.
if(NoParametersOut != null)
{
// Fire the event.
NoParametersOut(this, new EventArgs());
_noParametersOutButtonClicked = false;
}
}
}
}
}
Voir aussi
Référence
IParametersOutProvider interface
IParametersOutProvider - Membres
Microsoft.SharePoint.WebPartPages.Communication - Espace de noms