WebPartZoneBase.AllowLayoutChange 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,指出區域中 WebPart 控制項的配置是否可以變更。
public:
virtual property bool AllowLayoutChange { bool get(); void set(bool value); };
[System.Web.UI.Themeable(false)]
public virtual bool AllowLayoutChange { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.AllowLayoutChange : bool with get, set
Public Overridable Property AllowLayoutChange As Boolean
屬性值
如果配置可以變更,則為 true
,否則為 false
。 預設為 true
。
- 屬性
範例
下列程式碼範例示範 控制項上 WebPartZone 屬性的 AllowLayoutChange 宣告式用法。 如需完整的程式碼範例,包括程式碼後置原始程式檔和包含此程式碼中區域的 .aspx 頁面,請參閱 WebPartZoneBase 類別概觀。
請注意,屬性 AllowLayoutChange 設定為 true
,這是預設值。 如果您將值 false
變更為 ,當您將頁面載入瀏覽器並將頁面切換為設計顯示模式之後,您將無法將控制項拖曳到 WebPartZone2
區域內或區域中。
<asp:WebPartZone
ID="WebPartZone2"
Runat="server"
DragHighlightColor="#00ff00"
AllowLayoutChange="true"
EmptyZoneText="Add WebParts to this empty Zone."
BorderWidth="2"
BorderColor="DarkBlue"
BorderStyle="Dashed"
MenuLabelText="Verbs Menu"
MenuPopupImageUrl="label.gif" >
<VerbStyle Font-Italic="true" />
<MenuLabelStyle BackColor="Lime" BorderWidth="1" />
<MenuLabelHoverStyle Font-Bold="true" />
<MenuVerbHoverStyle BackColor="LightGrey" />
<MenuVerbStyle Font-Italic="true" />
<ZoneTemplate>
<asp:Label ID="Label1" Runat="server" Title="Date" />
</ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone
ID="WebPartZone2"
Runat="server"
DragHighlightColor="#00ff00"
AllowLayoutChange="true"
EmptyZoneText="Add WebParts to this empty Zone."
BorderWidth="2"
BorderColor="DarkBlue"
BorderStyle="Dashed"
MenuLabelText="Verbs Menu"
MenuPopupImageUrl="label.gif" >
<VerbStyle Font-Italic="true" />
<MenuLabelStyle BackColor="Lime" BorderWidth="1" />
<MenuLabelHoverStyle Font-Bold="true" />
<MenuVerbHoverStyle BackColor="LightGrey" />
<MenuVerbStyle Font-Italic="true" />
<ZoneTemplate>
<asp:Label ID="Label1" Runat="server" Title="Date" />
</ZoneTemplate>
</asp:WebPartZone>
備註
只有在 AllowLayoutChange 區域處於頁面顯示模式時,屬性才會生效,其中可以變更區域中控制項的配置,例如 DesignDisplayMode 。
當 AllowLayoutChange 設定 false
為指定區域時,有一些動作會防止終端使用者在區域中的控制項上執行:
使用者無法將控制項拖曳至不同的區域、重新排欄區域內的控制項,或將控制項移至區域。
區域中控制項 (UI) WebPart 影響使用者介面的一些屬性會停用,讓使用者在使用 和 BehaviorEditorPart 控制項編輯控制項時 AppearanceEditorPart ,無法編輯這些屬性。
使用者無法從 CatalogPart 控制項將新的控制項新增至區域。
區域控制項上不會顯示關閉、刪除、最小化和還原動詞。
AllowLayoutChange雖然 屬性會影響使用者透過 UI 變更區域配置的能力,但不會影響以程式設計方式變更版面配置的能力。 例如,如果 AllowLayoutChange 設定 false
為 ,則使用者無法關閉區域中的控制項,但開發人員仍然可以呼叫 CloseWebPart 方法來以程式設計方式關閉控制項。
這個屬性無法由佈景主題或樣式表主題設定。 如需詳細資訊,請參閱 ThemeableAttribute 和 ASP.NET 主題和麵板。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應