Source view of PANEL.ASPX
DotNet Funda: Code Viewer
panel.aspx | panel.aspx.cs
Close Window  
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td style="padding-left:10px;" valign="middle">
                asp:Panel control</td>
        </tr>
        <tr>
            <td class="ArticleContents">
                Panel control is generally used to keep a set of controls into it.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        Panel control is generally used to keep a set of controls into it. It is frequently used when you have to programmatically generate controls. 
        When it is rendered on the page, generally it is implemented through &lt;div&gt; HTML tag.
        <p>
        Its properties like <span class="DemoCP">BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. </span>
        are implemented through style properites of &lt;input&gt; tag. 
        </p>        
        
        Following are some important properties that are very useful.
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <td class="DemoCP">GroupingText</td>
                <td>
                    Its used to set the caption of the group of controls inside the panel.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Visible</td>
                <td>
                    true/false. Used to hide or show the panel.
                </td>
            </tr>
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : Panel
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/panel.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Panel ID="Panel1" runat="server" GroupingText="Panel Control Test"></asp:Panel>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <pre>
// Panel Control /////////////////////////////////////////////
&lt;asp:Panel ID="Panel1" runat="server" GroupingText="Panel Control Test"&gt;&lt;/asp:Panel&gt;

// Code Behid Code /////////////////////////////////////////////
 private void PopulatePanel()
    {
        // Add ASP.NET Server Control
        TextBox txt1 = new TextBox();
        txt1.ID = "txt1";
        txt1.Width = 300;
        txt1.Text = "This control added from Server side.";
        Panel1.Controls.Add(txt1);

        // Add HTML controls
        string strHTML = "&lt;hr /&gt;&lt;table border='1'&gt;&lt;tr&gt;&lt;td&gt;This contorl and outer HTML Table also added from Server side&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;input type='text' name='txtname' id='txtname' /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
        Panel1.Controls.Add(new LiteralControl(strHTML));
            
    }
                    </pre>
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
    
    <script language="javascript" type="text/javascript">
        function GiveAlertToUser()
        {
            alert("Hi Dear, Client side method worked.");
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top