Hide, show panel : Panel « ASP.net Controls « ASP.NET Tutorial






<%@Page language="c#" runat="server" %>
<script runat="server">
protected void Page_Load(object o, EventArgs e) {
    step1.Visible = false;
    step2.Visible = false;
    step3.Visible = false;
    if(!IsPostBack) {
        step1.Visible = true;
        return;
    }
}

protected void ClickStep1(object o, EventArgs e) {
    step2.Visible = true;
}

protected void ClickStep2(object o, EventArgs e) {
    theFinalName.Text = theName.Text;
    theFinalHobby.Text = theHobby.Text;
    step3.Visible = true;
}
</script>

<form runat="server">
<asp:panel id="step1" runat="server">
Name: <asp:textbox id="theName" runat="server" />
<asp:button type="submit" id="submitStep1" runat="server" Text="Go" onClick="ClickStep1"/>
</asp:panel>

<asp:panel id="step2" runat="server">
Hobby: <asp:textbox id="theHobby" runat="server"/>
<asp:button type="submit" id="submitStep2" runat="server" Text="Go" onclick="ClickStep2" />
</asp:panel>

<asp:panel id="step3" runat="server">
Done!<br />
Name: <asp:label id="theFinalName" runat="server" /><br/>
Hobby: <asp:label id="theFinalHobby" runat="server" /><br/>
</asp:panel>
</form>








3.20.Panel
3.20.1.Important properties, methods and events of Panel control
3.20.2.Use asp:panel to host asp.net controls
3.20.3.The ScrollBars property enables you to display scrollbars around a panel
3.20.4.The Panel control enables you to work with a group of ASP.NET controls: show or hide
3.20.5.Set AssociatedControlID for asp:Panel
3.20.6.Hide, show panel