SIGN UP MEMBER LOGIN:    
ARTICLE

Panel Control in ASP.Net

Posted by Ravinder Verma Articles | ASP.NET Controls in C# November 01, 2010
The Panel control is used as a container for other controls. This control is often used to generate controls by code and to display or hide groups of controls as per the condition.
Reader Level:
Download Files:
 

The Panel control is used as a container for other controls. This control is often used to generate controls by code and to display or hide groups of controls as per the condition.

Note: This control always renders as an HTML <div> element.

Source Code:

<asp:Panel ID="pnlMain" runat="server"
        BackImageUrl="~/Images/FunnyScraps3.jpg"
        GroupingText="This is Sample Group Text"
        HorizontalAlign="Center"
        ScrollBars="Both"
        Direction="LeftToRight"
        Wrap="true"
        DefaultButton="btnSave"
        Height="400px" Width="500px">
        <table>
            <tr>
                <td colspan="2">
                    The Panel control is used as a container for other controls. This control is often used to generate controls by code and to display and hide groups of controls.
                </td>
            </tr>
            <tr>
                <td>User Name</td>
                <td><asp:TextBox ID="txtUserID" runat="server" /></td>
            </tr>
            <tr>
                <td>User Password</td>
                <td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /></td>
            </tr>
            <tr>
                <td>Confirm Password</td>
                <td><asp:TextBox ID="txtConfirmPassword" runat="server" TextMode="Password"/></td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="Save" />
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                </td>
            </tr>
        </table>
</asp:Panel>

Properties

BackImageUrl

Use to specify a URL to an image file to display as a background for this control.

1.gif
 
GroupingText

Use to specify the caption for the group of controls in the panel.

2.gif
 
DefaultButton

Use to specify the ID of the default button in the panel. This is useful to fire submit or else event when you are within this panel controls.

HorizontalAlign

Use to specify the horizontal alignment of the content. The possible values are:
  • Center
  • Justify
  • Left
  • NotSet
  • Right
3.gif

Direction

Use to specify the content display direction of the panel. The possible values for this property are:
  • LeftToRight
  • NotSet
  • RightToLeft
4.gif 

Wrap

Use to specify whether the content should wrap or not. Default is true. If the width of panel is specified and set this property as false then the content will move out from the panel.

5.gif
 
ScrollBars

Use to specify the position and visibility of scroll bars in the panel. The possible values for this property are:
  • Auto
  • Both
  • Horizontal
  • None
  • Vertical
 
6.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor