ICellProvider.CellReady 事件
请注意:此 API 现在已过时。
命名空间: Microsoft.SharePoint.WebPartPages.Communication
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")> _
Event CellReady As CellReadyEventHandler
用法
Dim instance As ICellProvider
Dim handler As CellReadyEventHandler
AddHandler instance.CellReady, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartField instead")]
event CellReadyEventHandler CellReady
备注
此外应使用CellReady事件单元格的初始值发送适当的情况。每次PartCommunicationMain事件处理程序运行时,将发生CellReady事件。对于客户端连接, CellReady事件可以PartCommunicationMain运行后随时发生。
示例
下面的代码示例显示创建CellReadyEventArgs数据结构,以包含提供单元格的值,重写的PartCommunicationMain方法设置单元格的值,然后将触发CellReady事件。此代码示例是示例的一个更大提供的ICellProvider接口的一部分。
' Step #10: 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 CellReady event. Some parts
' may not behave properly if they are left waiting for this
' information.
Public Overrides Sub PartCommunicationMain()
' Check if connected.
If _connected Then
' Create the CellReadyEventArgs data structure for the
' CellProviderInit event.
Dim cellReadyArgs As New CellReadyEventArgs()
' If the user clicked the button, then send the value.
If _cellClicked Then
' Set the cell to the value of the TextBox text
' This is the value that will be sent to the
' Consumer
cellReadyArgs.Cell = _cellInput.Text
Else
' The user didn't actually click the button
' so just send an empty string to the consumer.
cellReadyArgs.Cell = ""
End If
' Fire the CellReady event.
' The Consumer will receive the cell value in its
' CellReady event handler
RaiseEvent CellReady(Me, cellReadyArgs)
End If
End Sub
// Step #10: 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 CellReady event. Some parts
// may not behave properly if they are left waiting for this
// information.
public override void PartCommunicationMain()
{
// Check if connected.
if(_connected)
{
// If there is a listener, fire the CellReady event.
if (CellReady != null)
{
// Create the CellReadyEventArgs data structure for the
// CellProviderInit event.
CellReadyEventArgs cellReadyArgs = new
CellReadyEventArgs();
// If the user clicked the button, then send the value.
if (_cellClicked)
{
// Set the cell to the value of the TextBox text.
// This is the value that will be sent to the Consumer
cellReadyArgs.Cell = _cellInput.Text;
}
else
{
// The user didn't actually click the button
// so just send an empty string to the consumer.
cellReadyArgs.Cell = "";
}
// Fire the CellReady event.
// The Consumer will receive the cell value in its
// CellReady event handler
CellReady(this, cellReadyArgs);
}
}
}