Ajax Accordion Control Example
Introduction
In this article i am going to explain Ajax Accordion Control. which will help to create rich webpage.
Description
Ajax Accordion Panel helps to create or develop a rich web page which also allows to put control inside it. The Accordion is a web control that allows you to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time. The Accordion is implemented as a web control that contains AccordionPane web controls. Each AccordionPane control has a template for its Header and its Content. We keep track of the selected pane so it stays visible across postbacks.
It also supports three AutoSize modes so it can fit in a variety of layouts.
Property | description |
---|---|
None | The Accordion grows/shrinks without restriction. This can cause other elements on your page to move up and down with it. |
Limit | The Accordion never grows larger than the value specified by its Height property. This will cause the content to scroll if it is too large to be displayed. |
Fill | The Accordion always stays the exact same size as its Height property. This will cause the content to be expanded or shrunk if it isn't the right size. |
design style as below
- .accordionContent {
- background-color: #FFF7EA; /*#D3DEEF;*/
- border-color: -moz-use-text-color #2F4F4F #2F4F4F;
- border-right: 1px dashed #2F4F4F;
- border-style: none dashed dashed;
- border-width: medium 1px 1px;
- padding: 10px 5px 5px;
- width:20%;
- }
- .accordionHeaderSelected {
- background-color:Orange; /*#5078B3;*/
- border: 1px solid #2F4F4F;
- color: white;
- cursor: pointer;
- font-family: Arial,Sans-Serif;
- font-size: 12px;
- font-weight: bold;
- margin-top: 5px;
- padding: 5px;
- width:20%;
- }
- .accordionHeader {
- background-color:#FD1C10; /*#2E4D7B;*/
- border: 1px solid #2F4F4F;
- color: white;
- cursor: pointer;
- font-family: Arial,Sans-Serif;
- font-size: 12px;
- font-weight: bold;
- margin-top: 5px;
- padding: 5px;
- width:20%;
- }
- .href
- {
- color:White;
- font-weight:bold;
- text-decoration:none;
- }
design Accordion.aspx like below.
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1">
- <title></title>
- <style type="text/css">
- </style>
- </head>
- <body>
- <form name="form1" id="form1" runat="server">
- <ajax:ToolkitScriptManager ID="Scriptmanager1" runat="server"/>
- <div >
- <ajax:Accordion ID="UserAccordion" runat="server" SelectedIndex="0"
- HeaderCssClass="accordionHeader"
- HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
- FadeTransitions="true" SuppressHeaderPostbacks="true" TransitionDuration="250"
- FramesPerSecond="40" RequireOpenedPane="false" AutoSize="None" >
- <Panes>
- <ajax:AccordionPane ID="AccordionPane1" runat="server" >
- <Header><a href="#" class="href">New User</a></Header>
- <Content>
- <asp:Panel ID="UserReg" runat="server">
- <table align="center">
- <tr>
- <td></td>
- <td align="right" >
- </td>
- <td align="center">
- <b>Registration Form</b>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right" >
- UserName:
- </td>
- <td>
- <asp:TextBox ID="txtuser" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right" >
- Password:
- </td>
- <td>
- <asp:TextBox ID="txtpwd" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- FirstName:
- </td>
- <td>
- <asp:TextBox ID="txtfname" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- LastName:
- </td>
- <td>
- <asp:TextBox ID="txtlname" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- Email:
- </td>
- <td>
- <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right" >
- Phone No:
- </td>
- <td>
- <asp:TextBox ID="txtphone" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right" >
- Location:
- </td>
- <td align="left">
- <asp:TextBox ID="txtlocation" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td align="left" ><asp:Button ID="btnsubmit" runat="server" Text="Save"/>
- <input type="reset" value="Reset" />
- </td>
- </tr>
- </table>
- </asp:Panel>
- </Content>
- </ajax:AccordionPane>
- <ajax:AccordionPane ID="AccordionPane2" runat="server">
- <Header><a href="#" class="href">User Detail</a></Header>
- <Content>
- <asp:Panel ID="Panel1" runat="server">
- <table align="center">
- <tr>
- <td align="right" colspan="2">
- FirstName:
- </td>
- <td>
- <b>Vaghela</b>
- </td>
- </tr>
- <tr>
- <td align="right" colspan="2">
- LastName:
- </td>
- <td>
- <b>K</b>
- </td>
- </tr>
- <tr>
- <td align="right" colspan="2" >
- Location:
- </td>
- <td align="left">
- <b>Gujarat</b>
- </td>
- </tr>
- </table>
- </asp:Panel>
- </Content>
- </ajax:AccordionPane>
- <ajax:AccordionPane ID="AccordionPane3" runat="server">
- <Header><a href="#" class="href">Job Details</a> </Header>
- <Content>
- <asp:Panel ID="Panel2" runat="server">
- <table align="center">
- <tr>
- <td></td>
- <td align="right">
- Job Type:
- </td>
- <td>
- <b>Software</b>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- Industry:
- </td>
- <td>
- <b>IT</b>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- Designation:
- </td>
- <td>
- <b>Software Engineer</b>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right">
- Company:
- </td>
- <td>
- <b>aspdotnet2u</b>
- </td>
- </tr>
- <tr>
- <td></td>
- <td align="right" >
- Location:
- </td>
- <td align="left">
- <b>Gujarat</b>
- </td>
- </tr>
- </table>
- </asp:Panel>
- </Content>
- </ajax:AccordionPane>
- </Panes>
- </ajax:Accordion>
- </div>
- </form>
- </body>
- </html>
Demo
Read more: http://aspdotnet2u.blogspot.com/2012/09/ajax-accordian-control-example-ajax.html#ixzz2WpsJEpcZ
No comments:
Post a Comment