IFilterConsumer.FilterConsumerInit 事件
请注意:此 API 现在已过时。
初始化事件接收字段和 (可选) 用于筛选列表的字段的显示名称的列表。
命名空间: Microsoft.SharePoint.WebPartPages.Communication
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")> _
Event FilterConsumerInit As FilterConsumerInitEventHandler
用法
Dim instance As IFilterConsumer
Dim handler As FilterConsumerInitEventHandler
AddHandler instance.FilterConsumerInit, handler
[ObsoleteAttribute("Use System.Web.UI.WebControls.WebParts.IWebPartParameters instead")]
event FilterConsumerInitEventHandler FilterConsumerInit
示例
下面的代码示例演示将触发FilterConsumerInit事件重写的PartCommunicationInit方法。此代码示例是示例的一个更大提供的IFilterConsumer接口的一部分。
' Step #7: Override PartCommunicationInit method.
' PartCommunicationInit() is called by the Web Part infrastructure
' during the ASP.NET PreRender event to allow the part to pass
' initialization information to the other connected parts.
' It is important to always pass initialization information. Some parts
' may not behave properly if this initialization information is not
' received.
Public Overrides Sub PartCommunicationInit()
' If the connection wasn't actually formed then we don't want to
' send the Init event.
If _connected Then
' Ensure that all of the Web Part's controls are created.
' The _filterFieldNames and _filterFieldDisplayNames are set
' during EnsureChildControls().
EnsureChildControls()
' Create the FilterConsumerInitEventArgs object for the
' FilterConsumerInit event.
Dim filterConsumerInitArgs As New FilterConsumerInitEventArgs()
' Set the field names.
filterConsumerInitArgs.FieldList = _filterFieldNames
filterConsumerInitArgs.FieldDisplayList = _filterFieldDisplayNames
' Fire the FilterConsumerInit event.
RaiseEvent FilterConsumerInit(Me, filterConsumerInitArgs)
End If
End Sub
// Step #7: Override PartCommunicationInit method.
// PartCommunicationInit() is called by the Web Part infrastructure
// during the ASP.NET PreRender event
// to allow the part to pass initialization information to the other
// connected parts.
// It is important to always pass initialization information.
// Some parts may not behave properly if this initialization
// information is not received.
public override void PartCommunicationInit()
{
// If the connection wasn't actually formed then don't want to send
// Init event.
if(_connected)
{
// Ensure that all of the Web Part's controls are created.
// The _filterFieldNames and _filterFieldDisplayNames are set
// during EnsureChildControls()
EnsureChildControls();
// If there is a listener, fire the FilterConsumerInit event.
if (FilterConsumerInit != null)
{
// Create the FilterConsumerInitEventArgs object for the
// FilterConsumerInit event.
FilterConsumerInitEventArgs filterConsumerInitArgs = new FilterConsumerInitEventArgs();
// Set the field names.
filterConsumerInitArgs.FieldList = _filterFieldNames;
filterConsumerInitArgs.FieldDisplayList = _filterFieldDisplayNames;
// Fire the FilterConsumerInit event.
FilterConsumerInit(this, filterConsumerInitArgs);
}
}
}