In the Ajax accordion control, how to control the items that have been selected

Source: Internet
Author: User

In the Ajax accordion control, how to control the items that have been selected

 

The first item is always displayed when the accordion control is used. When different users display different items, how to control the items that you just clicked after returning them.

Below is the solution.

1) Save the folder name and the ID of the corresponding accordionpane of the project where each ASPX page is located. The main purpose of this step is to find accordionpane by the name of the folder where aspx is located.
2) after return, compare the folder name in the URL path with the saved value. The corresponding items are displayed.

The column is as follows:

1) Add the accordion control on the ASPX page. The source code is summarized as follows:

Project folders include:

2) map the project folder name of each ASPX page to accordionpane ID and save it.

 

// Define menu list
Private   Static Idictionary < String , String > _ Menulist { Get ; Set ;}
Protected   Void Page_load ( Object Sender, eventargs E)
{
/*
The menu list is in the format of <folder directory name, accordionpane ID>
The workflowdesigner folder of the following edge corresponds to accordionpane of apworkflow
*/
_ Menulist =   New Dictionary < String , String > (){
{ " Workflowdesigner " , " Apworkflow " },
{ " Reporting " , " Apreporting " },
{ " Businessmanager " , " Apbusiness " },
{ " Message " , " Apmessage " },
{ " Organizationmanager " , " Aporgnization " },
{ " Systemlog " , " Apsystemlog " },
{ " Modulemanagemanet " , " Apmodule " }
};
Setmenueactiveindex ();
}

 

 

 

3 ) Get the folder name through the URL path, and find the items to be selected through comparison.
///   <Summary>
/// Set currently selected items
///   </Summary>
Private   Void Setmenueactiveindex ()
{
String Currentpage = Getcurrenturl ();
If ( ! String . Isnullorempty (currentpage ))
{
String Currentpagelower = Currentpage. tolower ();
If (_ Menulist. Keys. Contains (currentpagelower ))
{
// Record Index
Int Index =   - 1 ;
Foreach (VAR item In Mainmenue. PANES)
{
// Check whether the data is displayed
If (Item. Visible =   True )
{
Index ++ ;
If (Item. Id. tolower () = _ Menulist [currentpagelower]. tolower ())
{
// Set the items to be displayed
Mainmenue. selectedindex = Index;
Break ;
}
}
}
}
}
}

///   <Summary>
/// Obtain the Directory Name of the page based on the current link.
///   </Summary>
///   <Returns> </returns>
Private   String Getcurrenturl ()
{
String Resultstring =   "" ;
String [] Splitlist = Request. url. absolutepath. Split ( ' / ' );
If (Splitlist. Length >   2 )
{
If ( ! String . Isnullorempty (splitlist [splitlist. Length -   2 ])
{
Resultstring = Splitlist [splitlist. Length -   2 ];
}
}
Return Resultstring;
}

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.