共用方式為


WebPart.Connections property

取得或設定儲存連線的網頁組件的連線資訊。

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
<WebPartStorageAttribute(Storage := Storage.Shared)> _
<BrowsableAttribute(False)> _
Public Property Connections As String
    Get
    Set
'用途
Dim instance As WebPart
Dim value As String

value = instance.Connections

instance.Connections = value
[WebPartStorageAttribute(Storage = Storage.Shared)]
[BrowsableAttribute(false)]
public string Connections { get; set; }

Property value

Type: System.String
會指定連線資訊string值。預設值為String.Empty除外的網頁組件。

備註

String,指定Connections屬性具有下列格式儲存網頁組件的每個連線。

ConsumerPartID,ProviderPartID,ConsumerInterfaceName,ProviderInterfaceName,ConsumerIntefaceGroupName,ProviderIntefaceGroupName, XformInfo,CrossPageConnectionID,CrossPageURL,CrossPageInitEventArgs

儲存網頁組件,以分號 (;) 分隔每個連接的每個連接的重複此格式。儲存的最後一個連線後應沒有分號。

下表說明每個Connections屬性字串的組件。

名稱

描述

ConsumerPartID

使用者網頁組件ConnectionID

ProviderPartID

提供者網頁組件ConnectionID 。不過,如果使用者是在個人化模式中,會建立連線,並提供者網頁組件是還沒有ConnectionID共用組件時,網頁組件基礎結構會改用識別網頁組件中使用webPartID屬性。這是因為ConnectionID不能指派,並儲存在個人化模式中的網頁組件時。

ConsumerInterfaceName

取用者網頁組件 (如連線介面的RegisterInterface方法所定義) interfaceName 。其字串,例如:

myRowConsumer_WPQ_.

ProviderInterfaceName

提供者網頁組件 (如連線介面的RegisterInterface方法所定義) interfaceName 。其字串,例如:

myRowProvider_WPQ_.

ConsumerInterfaceGroupName

使用者網頁組件interfaceName 。此設定為相同的ConsumerInterfaceName參數。

ProviderInterfaceGroupName

提供者網頁組件interfaceName 。此設定為相同的ProviderInterfaceName參數。

XFormInfo

(選用)它需要在執行階段期間執行其邏輯轉換程式可以在其中儲存任何去除混淆資訊的字串。下列的定義和範例是針對隨附的網頁組件基礎結構的轉換程式。

  • IRowProvider to ICellConsumer

    單一的 string 值,對應到可從IRowProvider傳送至ICellConsumer表單IRowProviderColumnName中的資料欄名稱。下列範例會顯示指定欄名為名字IRowProvider的字串。

    First%20Name

  • IRowProvider to IFilterConsumer

    兩個對應會比對篩選在表單中的兩個資料行名稱的字串: IFilterConsumerColumn = IRowProviderColumn。下列範例會顯示名為姓氏使用欄名為姓氏IRowProvider所提供的資料行上指定篩選IFilterConsumer的字串。

    Surname=Last%20Name

  • IRowProvider to IParametersInConsumer

    比對配對的表單中顯示相同的資料欄的一組: (IRowProviderColumn = IParametersInConsumerPropertyName ).

    (First%20Name=FName)(Last%20Name=LName)(Phone%20Number=Phone)(Company=Co)

  • IParametersOutProvider to IParametersInConsumer

    比對配對的表單中顯示相同的資料欄的一組: (IParametersOutProviderPropertyName = IParametersInConsumerPropertyName )...]

    (First=FName)(Last=LName)(Number=Phone)(Employer=Co)

CrossPageConnectionID

(選用)跨網頁連線,這是連線的 [其他網頁組件連線] 頁面上的唯一識別碼。crosspageconnectionid參數Guid ,且必須是唯一的兩個頁面上。製作工具應產生這個 id。

CrossPageURL

(選用)跨網頁連線,這是要連線之網頁組件頁面的 URL。

CrossPageInitEventArgs

(選用)跨網頁連線,這是介面的InitEventArgs結構的其他網頁組件所連線的格式化為 XML 片段] 頁面上。以下是格式化CrossPageInitEventArgs參數IFilterConsumerInitEventArgs結構的範例。

<FilterConsumerInitEventArgs>><Field FieldName="First Name" FieldDisplayName="First Name"/><Field FieldName="Surname" FieldDisplayName="Sur Name"/><Field FieldName="Phone" FieldDisplayName="Phone Number"/><Field FieldName="Company" FieldDisplayName="Company"/></FilterConsumerInitEventArgs>

以下是格式化CrossPageInitEventArgs參數IParametersInConsumerInitEventArgs結構的範例。

<ParametersInConsumerInitEventArgs><Parameter ParameterName="LName" ParameterDisplayName="Last Name" Required="True" Description="Last Name of an employee."><Parameter ParameterName="FName" ParameterDisplayName="First Name" Required="True" Description="First Name of an employee."><Parameter ParameterName="Co" ParameterDisplayName="Company" Required="False" Description="Company the employee previously worked for."><Parameter ParameterName="Phone" ParameterDisplayName="Business Phone" Required="False" Description="Business Phone Number of an employee."></ParametersInConsumerInitEventArgs>

逗號來分隔個別參數的連線。以分號用來分隔包括整個連線。空白字元不允許之前或之後的分隔符號。如果內任何參數使用逗點、 分號或百分比符號,網頁組件基礎結構會編碼分隔字元,如下表所示。

分隔符號

Encoding

,

%2 C

;

%3B

%

25%

Connections屬性的值會儲存在只有一側 (網頁組件) 的連線,除非是跨網頁連線。跨網頁連線] 中,連線會儲存具有兩邊的連線。根據預設,網頁組件基礎結構會儲存使用者網頁組件與Connections屬性的值,雖然儲存提供者端的連線,靜態網頁組件 ( WebPartZone控制外部網頁組件) 和跨網頁連線支援基礎結構。

這個屬性無法依個別使用者個人化。WebPartStorageAttribute其值為Storage.Shared,這會指定屬性會儲存具有相同值的所有使用者。僅限具有寫入網頁] 權限的使用者可以設定這個屬性。此屬性只能以程式設計方式設定。

Examples

以下是ICellProvider與ICellConsumer網頁組件在相同的網頁組件頁面之間的直接連線的Connections屬性設定值的範例。

f690a578-6d1b-4d04-b081-011a93fa23bf,332f8676-875b-44eb-a537-8f946edb7e5f,MyCellConsumer_WPQ_,MyCellProvider_WPQ_,MyCellConsumer_WPQ_,MyCellProvider_WPQ_

以下是連線的跨網頁與之間IFilterConsumer網頁組件IRowProvider使用轉換程式的網頁組件的兩側Connections屬性設定的範例。

在 [來源] 頁面 (來源 ASPX) 網頁組件的Connection屬性設定如下:

a93e4d5a-835b-4a80-80c0-a0e23149ed03,69c42cf9-e98b-4f6e-954a-42c7b46ba32e,MyFilterConsumerInterface_WPQ_,RowProviderInterface,MyFilterConsumerInterface_WPQ_,RowProviderInterface,Surname=Last%20Name,0e194b89-eaf0-4fcb-93f9-fe6c0a7a88d1,target.aspx,<FilterConsumerInitEventArgs>><Field FieldName="First Name" /><Field FieldName="Surname" /><Field FieldName="Phone" /><Field FieldName="Company" /></FilterConsumerInitEventArgs>

在 [目標] 頁面 (目標 ASPX) 網頁組件的Connection屬性設定如下:

a93e4d5a-835b-4a80-80c0-a0e23149ed03,69c42cf9-e98b-4f6e-954a-42c7b46ba32e,MyFilterConsumerInterface_WPQ_,RowProviderInterface,MyFilterConsumerInterface_WPQ_,RowProviderInterface,,0e194b89-eaf0-4fcb-93f9-fe6c0a7a88d1,source.aspx,

請參閱

參照

WebPart class

WebPart members

Microsoft.SharePoint.WebPartPages namespace