Control.Visible Control.Visible Control.Visible Control.Visible Property


取得或設定值,指出伺服器控制項是否會轉譯為頁面上的 UI。Gets or sets a value that indicates whether a server control is rendered as UI on the page.

 virtual property bool Visible { bool get(); void set(bool value); };
public virtual bool Visible { get; set; }
member this.Visible : bool with get, set
Public Overridable Property Visible As Boolean


如果控制項在頁面上可見,則為 true;否則為 falsetrue if the control is visible on the page; otherwise false.


如果這個屬性為false,則不會呈現伺服器控制項。If this property is false, the server control is not rendered. 組織頁面的版面配置時,您應該將此納入考慮。You should take this into account when organizing the layout of your page.


如果未轉譯容器控制項,即使您將個別控制項的Visible屬性設為true,也不會轉譯其包含的任何控制項。If a container control is not rendered, any controls that it contains will not be rendered even if you set the Visible property of an individual control to true. 在此情況下,即使您已false明確地Visible將它設定為true,個別控制項還是會傳回屬性的。In that case, the individual control returns false for the Visible property even if you have explicitly set it to true. (也就是說,如果父控制項Visible的屬性設定為false,則子控制項會繼承該設定,而設定會優先于任何本機設定)。(That is, if the Visible property of the parent control is set to false, the child control inherits that setting and the setting takes precedence over any local setting.)