ARTICLE

CollapsiblePanelExtender Control in Ajax

Posted by Sapna Articles | ASP.NET AJAX in VB.NET September 19, 2011
In this article we can easily add collapsible section in webpage.
 
Reader Level:

Working with CollapsiblePanelExtender Control in Ajax.

Introduction : The CollapsiblePanelExtender Control is a flexible extender control which help we can be easily add Collapsible sections in a Web page. This extender control target any ASP.NET Panel control.The page developer define which control on page should be open  or close control for the Panel or the Panel set automatic expand or colapse when mouse cursor move in or out of.

The Panel is also post-back aware on a client post back, it automatically remembers and restores client state.

Properties of the CollapsiblePanelExtender Control.

  • AutoCollapse.
  • AutoExpand.
  • Collapsed.
  • CollapsedControl ID.
  • CollapsedImage.
  • CollapsedSize.
  • CollapsedText.
  • ExpanedControl ID.
  • Expaned Iamge.

Step : 1 Open visual studio and go to file menu.

  • Select WebSite option.
  • Select ASP.NET WebSite.
  • Default.aspx page open.
ASP-page1.gif

Step : 2 Go to SolutionExplorer and right click.
  • Select add new items.
  • Select WebForms option and add.
  • Drag and drop control from toolbox.
  • Write code.
webforms.gif

Code :

    <title> collapse panel</title>
      <style type="text/css">
          .ColapsPanelHeader
          {}
          .colapspanel1
          {}
</
style
>
</head>
<
body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
     <div>
 <asp:Panel ID="Panel2" runat="server"  BackColor = "Aqua" CssClass = "ColapsPanelHeader"
            Height ="30px">
         <div style="padding:5px; cursor : pointer; vertical-align: middle;"  
>
<div style="float : left;" > Show Picture? </div>
<div style="float :left; margin-left: 20px;">
    <asp:Label ID="Label1" runat="server" Text="Label">(by)</asp:Label>
    </div>
    <div style="float: right; vertical-align: middle;">
        </div>
        </div>
        </asp:Panel>
 <asp:Panel ID="Panel1" runat="server" CssClass = "colapspanel1" Height ="136px">
 <br />
  <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl ="~/birdofparadiseWBtn.jpg"  AlternateText ="ASP.NET AJAX" ImageAlign ="Left"/>        </asp:Panel>
        </div>
<
asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID = "panel1"  CollapseControlID ="panel2" ExpandControlID ="panel2"   ExpandedImage ="~/birdofparadiseWBtn.jpg" Collapsed = "true" TextLabelID = "Label1" ExpandedText = "my flower" CollapsedText ="hi" ImageControlID = "Image1" CollapsedImage = "~/birdofparadiseWBtn.jpg"  SuppressPostBack ="true">    </asp:CollapsiblePanelExtender>
    </form
>
</body>
</
html>

Step : 3 Now press F5 and run the program.

out1.gif

Step : 4 When we click in hi option then hide detail image show name my flower
.

out2.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    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.
Nevron Diagram
Become a Sponsor