Prop Control Standard Visible
## ASP.NET Visible Property
The `Visible` property is a standard property shared across ASP.NET Web server controls. It determines whether a control is rendered on the page and sent to the client browser.
---
## Definition and Usage
The `Visible` property gets or sets a boolean value indicating whether a server control is rendered on the page.
* **`True` (Default):** The control is rendered on the page and is visible to the user.
* **`False`:** The control is not rendered on the page.
### Key Architectural Behavior
When `Visible` is set to `False`, the control is **not rendered into the HTML output** sent to the client browser. This is fundamentally different from CSS-based hiding (e.g., `display: none` or `visibility: hidden`), where the HTML markup is still present in the page source. With `Visible="False"`, the control does not exist in the client-side DOM, which saves bandwidth and enhances security for sensitive UI elements.
---
## Syntax
```xml
```
---
## Code Example
The following example demonstrates how to set a Button control to be invisible. Because `Visible` is set to `False`, this button will not be rendered in the final HTML source code of the page.
```xml
```
---
## Technical Considerations
### 1. Server-Side vs. Client-Side Hiding
* **`Visible="False"` (Server-Side):** The ASP.NET engine completely bypasses rendering for this control. It cannot be accessed or manipulated via client-side JavaScript because it does not exist in the browser's DOM.
* **CSS `display:none` (Client-Side):** The control is rendered into the HTML, but hidden visually. It can still be inspected in the browser's "View Source" and manipulated via JavaScript.
### 2. ViewState and Lifecycle
Even when `Visible` is set to `False`, the control still participates in the page lifecycle on the server. It is instantiated, its state is saved in ViewState, and you can still read or modify its properties in your code-behind (C# or VB.NET).
### 3. Parent-Child Propagation
If a container control (such as a `Panel`, `PlaceHolder`, or `GridView`) has its `Visible` property set to `False`, all of its child controls are also hidden and will not be rendered, regardless of their individual `Visible` property settings.
YouTip