Menu.RenderingMode 屬性

定義

取得或設定值,這個值指定 Menu 控制項會呈現 HTML table 項目和內嵌樣式,還是會呈現 listitem 項目和階層式樣式表 (CSS) 樣式。Gets or sets a value that specifies whether the Menu control renders HTML table elements and inline styles, or listitem elements and cascading style sheet (CSS) styles.

public:
 property System::Web::UI::WebControls::MenuRenderingMode RenderingMode { System::Web::UI::WebControls::MenuRenderingMode get(); void set(System::Web::UI::WebControls::MenuRenderingMode value); };
public System.Web.UI.WebControls.MenuRenderingMode RenderingMode { get; set; }
member this.RenderingMode : System.Web.UI.WebControls.MenuRenderingMode with get, set
Public Property RenderingMode As MenuRenderingMode

屬性值

MenuRenderingMode

一個值,指定 Menu 控制項會呈現 HTML table 項目和內嵌樣式,還是會呈現 listitem 項目和階層式樣式表 (CSS) 樣式。A value that specifies whether the Menu control renders HTML table elements and inline styles, or listitem elements and cascading style sheet (CSS) styles. 預設值是 DefaultThe default value is Default.

備註

屬性的值會 RenderingMode 決定功能表控制項呈現控制項標記的方式 MenuThe value of the RenderingMode property determines how the menu control renders markup for the Menu control.

在 ASP.NET 3.5 和更早版本中, Menu 控制項使用 HTML 專案 table 和內嵌樣式,在瀏覽器中指定功能表的外觀。In ASP.NET 3.5 and earlier versions, the Menu control uses HTML table elements and inline styles to specify the appearance of the menu in a browser. 在 ASP.NET 4 和更新版本中,控制項預設會 Menu 使用 HTML 專案 listitem 和級聯樣式表 (CSS) 樣式。In ASP.NET 4 and later versions, by default the Menu control uses HTML listitem elements and cascading style sheet (CSS) styles.

如果您未設定這個屬性, Menu 控制項會呈現適用于屬性所表示之 ASP.NET 版本的標記 Control.RenderingCompatibilityIf you do not set this property, the Menu control renders markup that is appropriate to the ASP.NET version that is indicated by the Control.RenderingCompatibility property. Menu 控制項會使用下列規則:The Menu control uses the following rules:

此屬性是為了回溯相容性而提供。This property is provided for backward compatibility. 如果 RenderingCompatibility 屬性指出您想要讓控制項產生與 ASP.NET 4 或更新版本相容的 HTML,但您希望 Menu 控制項成為使用舊版行為的例外狀況,您可以將此屬性設定為 TableIf the RenderingCompatibility property indicates that you want controls to generate HTML that is compatible with ASP.NET 4 or later, but you want the Menu control to be an exception that uses earlier behavior, you can set this property to Table. 例如,如果您有一個從右至左顯示文字的網頁,您可能會想要將此屬性設定為, Table 因為有些瀏覽器不會正確顯示由 List 右至左文字的模式標記。For example, if you have a Web page that displays text from right to left you might want to set this property to Table because some browsers do not display the List mode markup properly for right-to-left text.

適用於

另請參閱