WebPart.GetInitEventArgs method
NOTE: This API is now obsolete.
會傳回InitEventArgs中傳遞的介面的名稱。
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
<ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")> _
Public Overridable Function GetInitEventArgs ( _
InterfaceName As String _
) As InitEventArgs
'用途
Dim instance As WebPart
Dim InterfaceName As String
Dim returnValue As InitEventArgs
returnValue = instance.GetInitEventArgs(InterfaceName)
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
public virtual InitEventArgs GetInitEventArgs(
string InterfaceName
)
參數
InterfaceName
Type: System.String使用轉換程式Microsoft.SharePoint.WebPartPages.Communication命名空間中的介面。
傳回值
Type: Microsoft.SharePoint.WebPartPages.Communication.InitEventArgs
InitEventArgs 物件,例如網頁組件,實作ICellProvider介面所傳回的CellProviderInitEventArgs物件。
備註
GetInitEventArgs方法才有所需的Microsoft.SharePoint.WebPartPages.Communication命名空間,可以使用轉換程式,例如IRowProvider、 ICellConsumer、 IFilterConsumer、 IParametersOutProvider及IParametersInConsumer介面的介面。InitEventArgs方法會呼叫所製作的建立涉及轉換程式的連線所需的所有初始資料的使用者介面的 Web 式連線。它會使用轉換程式介面的開發人員必須覆寫WebPart上的虛擬方法。如果未覆寫,會顯示錯誤訊息。
Examples
下列程式碼範例會顯示覆寫的GetInitEventArgs方法。此程式碼範例會是範例的較大ICellConsumer介面所提供的一部分。
如需建立可連接網頁組件的步驟的概觀,請參閱 < Creating a Connectable Web Part。
' Step #11: Override the GetInitEventArgs() method.
' The GetInitEventArgs method is called by the Web Part infrastructure during the
' ASP.NET PreRender event to gather the necessary information it needs to build
' the transformer dialog box. The transformer dialog box
' is needed when connecting different interfaces such as IRowProvider
' to ICellConsumer. The transformer dialog box allows the user to map the fields between the
' interfaces. The GetInitEventArgs method only needs to be implemented for interfaces that
' can participate in a transformer which are the following:
' ICellConsumer, IRowProvider, IFilterConsumer, IParametersOutProvider, IParametersInConsumer.
' interfacename is the name of interface on which the Web Part infrastructure is requesting
' information.
' Returns an InitEventArgs object.
Public Overrides Function GetInitEventArgs(interfaceName As String) As InitEventArgs
' Check if this is my particular cell interface.
If interfaceName = "MyCellConsumerInterface" Then
' Create the object that will return the initialization arguments.
Dim cellConsumerInitArgs As New CellConsumerInitEventArgs()
' Set the FieldName and FieldDisplay name values.
cellConsumerInitArgs.FieldName = _cellName
cellConsumerInitArgs.FieldDisplayName = _cellDisplayName
' Return the CellConsumerInitEventArgs object.
Return cellConsumerInitArgs
Else
Return Nothing
End If
End Function
// Step #11: Override the GetInitEventArgs() method.
// The GetInitEventArgs method is called by the Web Part infrastructure during the ASP.NET PreRender event
// to gather the necessary information it needs to build the transformer dialog box. The transformer dialog box
// is needed when connecting different interfaces such as IRowProvider
// to ICellConsumer. The transformer dialog box allows the user to map the fields between the
// interfaces. The GetInitEventArgs method only needs to be implemented for interfaces that
// can participate in a transformer which are the following:
// ICellConsumer, IRowProvider, IFilterConsumer, IParametersOutProvider, IParametersInConsumer.
// <param name="interfacename">Name of interface on which the Web Part infrastructure is requesting information</param>
// <returns>An InitEventArgs object</returns>
public override InitEventArgs GetInitEventArgs(string interfaceName)
{
// Check if this is my particular cell interface.
if (interfaceName == "MyCellConsumerInterface")
{
// Create the object that will return the initialization arguments.
CellConsumerInitEventArgs cellConsumerInitArgs = new CellConsumerInitEventArgs();
// Set the FieldName and FieldDisplay name values.
cellConsumerInitArgs.FieldName = _cellName;
cellConsumerInitArgs.FieldDisplayName = _cellDisplayName;
// Return the CellConsumerInitEventArgs object.
return(cellConsumerInitArgs);
}
else
{
return(null);
}
}