Toggle the Visible property of controls that inherit from System.Web.UI.Control.The
ASPX page:
<html>
<body>
<form runat=”server”>
<asp:panel id=”pnlSample” runat=”server”>
<asp:Label id=”lblSample” runat=”server” Text=”Sample Text” />
</asp:panel>
<asp:button runat=”server” id=”btnToggle” Text=”Toggle Panel Visibility”
OnClick=”btnToggle_Click” />
</form>
</body>
</html>
In <script runat=”server” /> block or codebehind:
Sub btnToggle_Click(sender as object, e as EventArgs)
pnlSample.Visible = Not pnlSample.Visible
End Sub
The Panel control used here can contain other controls.When setting the Visible property
of the Panel, the change is reflected through the controls within the panel as well.
Because all the Web Server Controls inherit from System.Web.UI.Control, you can utilize
the Visible property of each of them.This property can be set to True or False.
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(100)
-
▼
August
(7)
- Validating User Form Input in ASP.NET
- Displaying a Calendar in a Web Form in ASP.NET
- Selectively Hiding or Revealing Portions of a Web ...
- Creating a Scrolling Table within a Web Form in AS...
- Submitting Data to Another Page Using ASP.NET
- Dynamically Adding Literal Text or HTML to a Web F...
- Creating an ASP.NET Page
-
▼
August
(7)
No comments:
Post a Comment