The Accordion Control is a part of the Microsoft Ajax Toolkit. The Accordion is a web control that allows you to provide multiple panes and display them one at a time. The Accordion Control organizes your content into expandable Panes or Tabs which can be clicked to make the content of that Pane visible while hiding all the others. The Accordion is implemented as a web control that contains Accordion Pane web controls. Each Accordion Pane control has a template for its Header and its Content.
When used properly, the Accordion control can be a very effective UI element that can not only help you save costly screen real-estate, but will also make your site look more interactive and organized.
The Accordion control is one of the few independent or stand-alone controls in the Microsoft Ajax Toolkit. By standalone we mean that it does not extend the behavior of any existing ASP. Net control, and is instead implemented independently.
In this article we will learn how to use the Accordion Control in our websites, the different properties that can be modified to change the control appearance and the functionality that you can add.
1. Disable View State Of A Page If Possible:
Page that does not require any post back events can have the view State off. By default the “ViewState” property is enabled, we can disable it in two ways:
(a) At control level: by set EnableViewState property to false
(b) At page level: using <%@ Page EnableViewState=”false” %>
Advantage: It decreases the memory allocation on server.
2. Use of String Builder For Concatenation:
All operations we do on strings are stored in memory as separate references. When we modify our string, at run time it returns a new string, leaving the previous string as garbage collected. To stop creation of new references we should use string builder whenever concatenation is required.