PersonalizationScope 列舉

定義

表示 WebPartManager 物件的個人化範圍,或套用至 Web 組件控制項上屬性的個人化範圍。Indicates the personalization scope for a WebPartManager object or the personalization scope that applies to a property on a Web Parts control.

public enum class PersonalizationScope
public enum PersonalizationScope
type PersonalizationScope = 
Public Enum PersonalizationScope
繼承
PersonalizationScope

欄位

Shared 1

在參照 WebPartManager 控制項上的範圍時,Shared 範圍的意義是,個人化資料套用至頁面上所有個人化控制項的所有使用者,並且也可儲存在頁面上。When referring to the scope on the WebPartManager control, Shared scope means that personalization data applies to all users for all personalizable controls on a page and is also available to be saved on the page.
參考與 Web 組件控制屬性相關的範圍時,Shared 範圍會指出屬性只允許載入或儲存與所有使用者相關的資料。When referring to the scope associated with a Web Parts control property, Shared scope indicates that the property normally only allows loading or saving of data associated with all users.

User 0

在參照 WebPartManager 控制項上的範圍時,User 範圍是指:針對頁面上所有可個人化控制項載入的特定使用者個人化資料,以及適用於所有使用者的個人化資料。When referring to the scope on the WebPartManager control, User scope means that personalization data that is user-specific, as well as personalization data that applies to all users, is loaded for all personalizable controls on a page. 只有使用者專屬的個人化資料可以儲存在頁面上。Only personalization data that is user-specific can be saved on the page.
參考與 Web 組件控制屬性相關的範圍時,User 範圍會指出在 Shared 範圍內執行頁面時,屬性只能載入和儲存適用於所有使用者的資料。When referring to the scope associated with a Web Parts control property, User scope indicates that the property can only load and store data applicable to all users when running on a page in Shared scope. 不過,當屬性的控制於 User 範圍內的頁面執行時,將會載入並合併屬性的每一使用者和所有使用者資料。However, when the property's control is running on a page in User scope, the property's per-user and all-user data will be loaded and merged. 在這種情況下,當頁面於 User 範圍範圍中執行時只會儲存每一使用者資料。In this case, though, only per-user data will be saved when a page is running in User scope scope.

範例

下列範例示範如何使用PersonalizationScope列舉:The following example demonstrates using the PersonalizationScope enumeration:

if (_manager.Personalization.Scope == PersonalizationScope.Shared)
{
    TextBox2.Text = "Shared Scope";
}
else
    TextBox2.Text = "User Scope";

備註

個人化範圍是 Web 組件個人化的主要概念, 而且與其他設定緊密整合, 包括頁面、透過WebPartManager控制項執行的範圍、與控制項上每個屬性相關聯的範圍, 以及控制項已加入頁面中。Personalization scope is a key concept in Web Parts personalization and is tightly integrated with other settings, including the scope that the page, through the WebPartManager control, is running in; the scope associated with each property on a control; and the way in which the control was added to the page. 如需有關個人化範圍的詳細資訊, 請參閱Web 組件個人化總覽For more information on personalization scope, see Web Parts Personalization Overview.

個人化範圍是指個人化資料如何適用于不同的使用者集合。Personalization scope refers to how personalization data is applicable to different sets of users. 有些個人化資料僅適用于頁面上的特定使用者和控制項。Some personalization data is applicable to only a specific user and control on a page. 其他個人化資料適用于所有觀看網站的使用者。Other personalization data is applicable to all users who view a site. 個人化範圍用於個人化的各種區域, 以指出應抓取和顯示哪一組資料。Personalization scope is used in various areas of personalization to indicate which set of data should be retrieved and displayed.

當頁面在個人化範圍Shared中執行時, 這表示只應載入特定控制項的個人化資料 (適用于所有流覽控制項的使用者)。When a page is running in Shared personalization scope, this indicates that only the personalization data for a specific control, applicable to all users viewing the control, should be loaded. 根據目前執行的使用者權限, 這種廣泛適用的資料也可以修改並儲存回資料存放區。Depending on the currently executing user's rights, this broadly applicable data can also be modified and saved back to the data store. 當頁面在個人化範圍User中執行時, 這表示應該根據目前執行的使用者來儲存和載入控制項的個人化資料。When a page is running in User personalization scope, this indicates that a control's personalization data should be saved and loaded based on the currently executing user. 通常, 這表示可以在控制項上載入和儲存使用者專屬的資料, 而廣泛適用的資料 (或共用資料) 只能在控制項上查看。Usually, this means user-specific data can be loaded and saved on a control, while broadly applicable data (or shared data) can only be viewed on the control.

管理個人化的高階生命週期的控制項,會在兩個個人化範圍的其中一個執行。WebPartManagerA WebPartManager control, which manages the high-level life cycle of personalization, executes in one of the two personalization scopes.

適用於