Set AssociatedControlID for asp:Panel : Panel « ASP.net Controls « ASP.NET Tutorial






<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)
        If rdlOther.Checked Then
            pnlOther.Visible = True
        Else
            pnlOther.Visible = False
        End If
    End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <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"
        OnClick="btnSubmit_Click" 
        Runat="server" />
    
    </div>
    </form>
</body>
</html>








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