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到個別控制項的屬性trueIf 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. 在此情況下,個別的控制項,會傳回falseforVisible屬性,即使您已明確地將它設定為trueIn 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.)