IParametersOutProvider.ParametersOutReady event
NOTE: This API is now obsolete.
參數清單時,就會傳送至消費者 Web 組件從提供者實作IParametersOutProvider介面的網頁組件,就會發生。在用戶端電腦上,它就會發生任何時間 ;不過,它通常被引發當更新或選取參數時。在伺服器上,它應該在WebPart.PartCommunicationMain方法中將其引發。
Namespace: Microsoft.SharePoint.WebPartPages.Communication
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event ParametersOutReady As ParametersOutReadyEventHandler
'用途
Dim instance As IParametersOutProvider
Dim handler As ParametersOutReadyEventHandler
AddHandler instance.ParametersOutReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event ParametersOutReadyEventHandler ParametersOutReady
備註
事件處理常式會接收包含與這個事件相關的資料型別Microsoft.SharePoint.WebPartPages.Communication.ParametersOutReadyEventArgs的引數。這個類別會提供其ParameterValues屬性中的字串陣列。陣列中的每個字串是參數的值。數字,此陣列中包含參數的順序必須符合所指定的ParametersOutProviderInit方法的Microsoft.SharePoint.WebPartPages.Communication.ParametersOutProviderInitEventArgs引數。
ParametersOutReady或NoParametersOut事件,應該永遠會引發 Web 組件實作IParametersOutProvider介面。如果它們不會收到這項資訊,某些 Web 組件可能會無法正確運作。引發ParametersOutReady事件傳送參數。引發NoParametersOut事件,不代表在參數中的任何變更。
Examples
下列程式碼範例示範的覆寫的PartCommunicationsMain方法時,就會引發ParametersOutReady事件。這個程式碼範例是提供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;
}
}
}
}
}
請參閱
參照
IParametersOutProvider interface