Control.Visible 属性


获取或设置一个值,该值指示服务器控件是否作为 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. 在这种情况下,即使已将 Visible 属性显式设置为 true,单独控件也会返回 falseIn 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.)