Make the asp panel visible (C#) : Panel « Asp Control « ASP.Net






Make the asp panel visible (C#)

<%@ Page Language="C#" %>
<script runat="server">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (rdlOther.Checked)
            pnlOther.Visible = true;
        else
            pnlOther.Visible = false;
    }
</script>
<html>
<head>
    <title>Show Panel</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    Select your favorite programming language:
    <br /><br />
    <asp:RadioButton
        id="rdlVisualBasic"
        GroupName="language"
        Text="Visual Basic"
        Runat="server" />
    <br /><br />
    <asp:RadioButton
        id="rdlCSharp"
        GroupName="language"
        Text="C#"
        Runat="server" />
    <br /><br />
    <asp:RadioButton
        id="rdlOther"
        GroupName="language"
        Text="Other Language"
        Runat="server" />
    <br />    
    <asp:Panel
        id="pnlOther"
        Visible="false"
        Runat="server">
        
        <asp:Label
            id="lblOther"
            Text="Other Language:"
            AssociatedControlID="txtOther"
            Runat="server" />
        <asp:TextBox
            id="txtOther"
            Runat="server" />    
        
    </asp:Panel>
    
    <br /><br />
    
    <asp:Button
        id="btnSubmit"
        Text="Submit"
        Runat="server" OnClick="btnSubmit_Click" />
    
    </div>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.Panel Control: border style (VB.net)
2.Panel Control: foreground and background color (VB.net)
3.Basic Panel Control: holding other controls (VB.net)
4.Scrollable asp panel (C#)
5.Hide and show asp:Panel in order to hide and show the controls it contains