IParametersOutProvider.ParametersOutReady 事件
请注意:此 API 现在已过时。
已准备好从提供程序实现IParametersOutProvider接口的 Web 部件发送到使用者 Web 部件的参数列表时发生。在客户端计算机上,会发生任何时间 ;但是,它通常会引发参数更新或选择时。在服务器上,它应引发WebPart.PartCommunicationMain方法中。
命名空间: Microsoft.SharePoint.WebPartPages.Communication
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<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事件,应始终会引发实现IParametersOutProvider接口的 Web 部件。如果没有收到此信息,某些 Web 部件可能不能正常工作。引发ParametersOutReady事件发送参数。引发NoParametersOut事件,以指示不由参数中的任何更改。
示例
下面的代码示例演示将触发ParametersOutReady事件重写的PartCommunicationsMain方法。此代码示例是示例的一个更大提供的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;
}
}
}
}
}