[CLOSED] Accordion Select Item

  1. #1

    [CLOSED] Accordion Select Item

    Can you select an item in the accordion from the code behind by the items ID on the pages load?

    aspx page:
    <ext:Accordion ID="AccordionMainMenu" runat="server">
    <ext:MenuPanel ID="MenuPanelMain" runat="server" Title="Main Menu" Icon="Application" Width="150">
       <Menu runat="server">
         <Items>
           <ext:MenuItem ID="ItemID1" runat="server" Text="Item 1" Icon="UserMagnify">
              
           </ext:MenuItem>
           
           <ext:MenuItem ID="ItemID2" runat="server" Text="Item 2" Icon="UserStar">
                      
           </ext:MenuItem>    
         </Items>
       </Menu>
     </ext:MenuPanel>
    </ext:Accordion>
    Codebehind: (this is what functionality I'm looking for)
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     Me.AccordionMainMenu.ActiveItem = "ItemID2"
    End Sub
    Does this functionality exist to select an item in the code behind that the expands and selects the item?

    Cheers

    CMA
  2. #2

    RE: [CLOSED] Accordion Select Item

    Hi CMA,

    That functionality does not exist in the <ext:Accordion> control. You would have to set the ActiveItem or ActiveIndex of the Accordion, then set the .SelectedIndex of the Menu.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Accordion1.ActiveItem = "Panel2";
            this.Panel2.SelectedIndex = 1;
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Coolite Toolkit Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager runat="server" />
            
            <ext:Panel runat="server" Height="300" Title="Title" Width="300">
                <Body>
                    <ext:Accordion ID="Accordion1" runat="server">
                        <ext:Panel ID="Panel1" runat="server" Title="Panel1" />
                        <ext:MenuPanel ID="Panel2" runat="server" Title="Panel2" Icon="Application" Width="150">
                           <Menu ID="Menu1" runat="server">
                             <Items>
                               <ext:MenuItem ID="MenuItem1" runat="server" Text="Item 1" Icon="UserMagnify" />
                               <ext:MenuItem ID="MenuItem2" runat="server" Text="Item 2" Icon="UserStar" />
                             </Items>
                           </Menu>
                        </ext:MenuPanel>
                        <ext:Panel ID="Panel3" runat="server" Title="Panel3" />
                    </ext:Accordion>
                </Body>
            </ext:Panel>
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] I'm trying to un-select an item, but its NOT working.
    By Fahd in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Aug 02, 2012, 6:13 PM
  2. [CLOSED] Combobox, select first item
    By Yevgeniy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 28, 2011, 12:05 PM
  3. Replies: 5
    Last Post: Nov 11, 2010, 7:33 PM
  4. Replies: 2
    Last Post: Apr 25, 2010, 2:15 AM
  5. Accordion Select Item
    By CMA in forum 1.x Help
    Replies: 0
    Last Post: Jun 15, 2009, 12:15 PM

Posting Permissions