IParametersInProvider.ParametersInReady 事件
请注意:此 API 现在已过时。
准备发送到使用者 Web 部件的参数列表时,发生此事件。在客户端计算机上,会发生此错误在任何时间 ;但是,它通常会引发参数更新或选择时。在服务器上,它必须提升PartCommunicationMain方法中。
命名空间: Microsoft.SharePoint.WebPartPages.Communication
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event ParametersInReady As ParametersInReadyEventHandler
用法
Dim instance As IParametersInProvider
Dim handler As ParametersInReadyEventHandler
AddHandler instance.ParametersInReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event ParametersInReadyEventHandler ParametersInReady
备注
事件处理程序接收类型Microsoft.SharePoint.WebPartPages.Communication.ParametersInReadyEventArgs包含与此事件相关的数据。ParametersInReadyEventArgs包含一个其ParameterValues属性中的字符串数组。数组中的每个字符串是参数的值。数量和参数表示该数组中的顺序必须相符Microsoft.SharePoint.WebPartPages.Communication.ParametersInConsumerInitEventArgs参数ParametersInConsumerInit方法中指定。
ParametersInReady事件或NoParametersIn事件,应始终会引发实现IParametersInProvider接口的 Web 部件。如果没有收到此信息,某些 Web 部件可能不能正常工作。引发ParametersInReady事件发送参数。引发NoParametersIn事件,以指示不由参数中的任何更改。
示例
下面的代码示例演示将触发ParametersInReady事件重写的PartCommunicationMain方法。此代码示例是示例的一个更大提供的IParametersInProvider接口的一部分。
' Step #7: Implement 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 ParametersInReady or
' the NoParametersIn event. Some parts
' may not behave properly if they are left waiting for this
' information.
' ParametersInReady should be fired to send the parameters.
' NoParametersIn 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
' Create the ParametersInReadyEventArgs object for the ParametersInReady event.
Dim parametersInReadyEventArgs As New ParametersInReadyEventArgs()
If _parametersReadyButtonClicked Then 'ParametersInReady Button was clicked
' Set the parameter values to the text box values.
If Not (_fieldList Is Nothing) Then
parametersInReadyEventArgs.ParameterValues = New String(_fieldList.Length) {}
Dim index As Integer
For index = 0 To _fieldList.Length - 1
parametersInReadyEventArgs.ParameterValues(index) = _fontAttributeTextBox(index).Text
Next index
' Fire the ParametersInReady event.
RaiseEvent ParametersInReady(Me, parametersInReadyEventArgs)
'_fieldList is null
Else
' Fire the event.
RaiseEvent NoParametersIn(Me, New EventArgs())
End If
_parametersReadyButtonClicked = False
ElseIf _noParametersInButtonClicked Then 'NoParametersIn Button was clicked
' Fire the NoParametersIn event.
RaiseEvent NoParametersIn(Me, New EventArgs())
_noParametersInButtonClicked = False
End If
End If
End Sub
// Step #7: Implement the PartCommunicationMain() method.
// The PartCommunicationMain method is called by the Web Part
// infrastructure on the client during the ASP.NET PreRender
// phase to allow the part to pass its primary data to the other
// connected parts.
// It is important to always fire either the ParametersInReady or the
// NoParametersIn event. Some parts
// may not behave properly if they are left waiting for this
// information.
// ParametersInReady should be fired to send the parameters.
// NoParametersIn 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 ParametersInReady event.
if(ParametersInReady != null)
{
// Create the ParametersInReadyEventArgs object for the
// ParametersInReady event.
ParametersInReadyEventArgs parametersInReadyEventArgs = new ParametersInReadyEventArgs();
// If the ParametersInReady button was clicked.
if(_parametersReadyButtonClicked)
{
// If there is a listener, fire the ParametersInReady
// event.
if(ParametersInReady != null)
{
// Set the parameter values to the text box values.
if (_fieldList != null)
parametersInReadyEventArgs.ParameterValues = new string[_fieldList.Length];
for (int index = 0; index < _fieldList.Length; index++)
{
parametersInReadyEventArgs.ParameterValues[index] = _fontAttributeTextBox[index].Text;
}
// Fire the ParametersInReady event.
ParametersInReady(this, parametersInReadyEventArgs);
_parametersReadyButtonClicked = false;
}
}
// If the NoParametersIn button was clicked.
else if(_noParametersInButtonClicked)
{
// If there is a listener, fire the NoParametersIn
// event.
if(NoParametersIn != null)
{
// Fire the event.
NoParametersIn(this, new EventArgs());
_noParametersInButtonClicked = false;
}
}
// The user didn't click any button.
else
{
// If there is a listener, fire the NoParametersIn
// event.
if(NoParametersIn != null)
{
// Fire the event
NoParametersIn(this, new EventArgs());
_noParametersInButtonClicked = false;
}
}
}
}
}