asp.net.ph

Control.Visible Property

System.Web.UI Namespace   Control Class


Sets or retrieves a value specifying whether a control should be rendered on the page.

Syntax


Inline <asp:control Visible = true | false ... >
Script Control.Visible = true | false

Property Value

This property accepts or returns only a boolean value: true if the control is to be rendered; otherwise false.

Remarks

If this property is false, the server control is not rendered. Authors should take this into account when organizing the lay out of the page.

Example

The following example shows how to declaratively set the Visible property of a control at design time.

<asp:panel id="myPanel" runat="server" visible=false>

The example below shows how to alternately show or hide a control by programmatically setting its Visible property at run time. The sample also demonstrates how the state of the Visible property can be used to conditionally modify the property of another control or render additional content on the page.

void ShowHide ( object src, EventArgs E ) {
   thePanel.Visible = thePanel.Visible ? false : true;
   myButton.Text = thePanel.Visible ? "Hide me" : "Show me";
}
  C# VB

 Show me 

The example below shows how to programmatically set the Visible property at run time, depending on the state of another control.

myGrid.PagerStyle.Visible = showPager.Checked;
  C# VB

 Show me 

See Also

Control Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph