<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"> </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 <div> HTML tag.
<p>
Its properties like <span class="DemoCP">BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. </span>
are implemented through style properites of <input> 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>
</td>
</tr>
<tr>
<td colspan="2">
<pre>
// Panel Control /////////////////////////////////////////////
<asp:Panel ID="Panel1" runat="server" GroupingText="Panel Control Test"></asp:Panel>
// 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 = "<hr /><table border='1'><tr><td>This contorl and outer HTML Table also added from Server side</td></tr><tr><td><input type='text' name='txtname' id='txtname' /></td></tr></table>";
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