JavaScript
  Home arrow JavaScript arrow Page 3 - The Accordion Component in the AJAX Contro...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

The Accordion Component in the AJAX Control Toolkit
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 13
    2007-03-20

    Table of Contents:
  • The Accordion Component in the AJAX Control Toolkit
  • The Accordion Component
  • Creating a web page displaying an Accordion
  • The design view of the Accordion
  • The page displayed on the browser

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Accordion Component in the AJAX Control Toolkit - Creating a web page displaying an Accordion


    (Page 3 of 5 )

    As mentioned earlier, the Accordion on this page will consist of three panes and duplicates the accordion shown in the first picture in this tutorial. The JAccordion.aspx page is added to the Sample Website that is bundled with the ACT download so that its reference to the AjaxControlToolkit.dll will be appropriate. Before any toolkit control can be placed on the page, you need to place the ScriptManager component form the AJAX Extension group on the page for reasons mentioned earlier. This can also be a drag and drop operation.

    Now drag and drop an Accordion component from the ATC Components group (first item). This creates a tiny  UI on the design pane of your web page. It can be resized to any desired size. The JAccordion.aspx source appears as follows after the addition of the Accordion. It has the Script Manager and the Accordion Controls.

    The AccordionPanes have to be added. Before adding the AccordionPanes, the Panes have to be added. You get drop-down help.  After the <ajaxToolkit:Accordion> tag, if you just type < and leave a space you will see the context menu as shown in the next picture. From this you choose the Panes in this case. You could also choose the templates for Content and Header. For this tutorial only "Panes" were chosen.

    With the Panes added, you can now add the AccordionPanes. The next picture shows the changes to the code with the first AccordionPane being added. To this first AccordionPane a header as well as content were also added. You get a context sensitive drop-down menu here as well.

    With this you may build the solution and bring up the JAccordion.aspx on the browser, which shows the following. This project is not hosted on the Internet server but on a folder where the unzipped AJAX extensions were placed. The program spawns a web server as seen in the address box.

    In a similar fashion you may drag and drop two other AccordionPane Components between the panes after the AccordionPane already in place. They are given Header text to simulate the DOJO Accordion in the first picture. When the page with all three AccordionPanes is built and brought up on the browser, it appears as shown here.

    You may also add content to the two other AccordionPanes as shown, simulating the DOJO Accordion. You will see a link added to the 'Hodentek' pane and a Calendar control from the Standard controls in the toolbox added to the 'ASPFree' pane. You have also added a few default colors for the backcolor property of the AccordionPanes. This is all that is necessary to get the accordion look and function like that created by the dojo widget as shown in the next picture.

    Attributes of the Accordion

    As seen earlier in the Object Browser there is rich functionality that can be used in creating the Accordion. The following attributes were added as shown in the next snippet for the Accordion.

    <ajaxToolkit:Accordion
        ID="Accordion1" runat="server"
        ContentCssClass="accordionContent"
        HeaderCssClass="accordionHeader"
        TransitionDuration="200"
        AutoSize="Fill"
        FadeTransitions="true"
        SelectedIndex="0"
        Height="300px"
        Width="500px"
        BorderWidth="1px"
        BorderColor="DarkOrange">

    The AutoSize property can have three values, None|Fill|Limit. When Fill is used the growth of the Accordion will be up to the Height attribute specified. The AccordionPanes added are indexed starting with the first (being 0), which if selected will be displayed. The transition time between Accordion Panes is set by the TransitionDuration, which is in milliseconds. With 200 ms set, the accordion panes still flutter in IE 7.0. The reader should seek out the object browser for many other attributes.

    More JavaScript Articles
    More By Jayaram Krishnaswamy


       · It does work well in IE 7.0, but there are some display problems in the other...
     

    JAVASCRIPT ARTICLES

    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT