Home arrow JavaScript arrow Page 3 - The Accordion Component in the AJAX Control Toolkit
JAVASCRIPT

The Accordion Component in the AJAX Control Toolkit


The Accordion component is one of the many components in the AJAX Control Toolkit (ACT). The ACT is a Microsoft Community project built upon ASP.NET 2.0 AJAX Extensions and will be a repository of web-client components.

Author Info:
By: Jayaram Krishnaswamy
Rating: 4 stars4 stars4 stars4 stars4 stars / 35
March 20, 2007
TABLE OF CONTENTS:
  1. · The Accordion Component in the AJAX Control Toolkit
  2. · The Accordion Component
  3. · Creating a web page displaying an Accordion
  4. · The design view of the Accordion
  5. · The page displayed on the browser

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials