View Full Version : Accordion menu - Wrong menu URL being generated

03-21-2010, 03:11 PM
1) Script Title: Bullet List Accordion menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

3) Describe problem:
I am using Visual Studio 2008 .NET Framework 3.5 SP1 and ASP.NET 3.5.

I have successfully installed the necessary elements for the menu and it works fine. However, there is a problem generating the URLs when I am testing it in development. My list items are as follows:

<li><a href="Folder/Page1.aspx">Title1</a></li>
<li><a href="Folder/Page2.aspx">Title2</a></li>

When I run my web site and choose either menu item, I get the right page displayed. If I then choose the other menu item, I get a 404 error. This is because the menu code is generating the wrong URL, as follows.

If I choose to display in the order above, instead of generating the correct URL for Page2, thus


it is generating


Is this a known problem with a fix?

03-22-2010, 07:29 AM
I assume you're generating the links using a server side language, as Accordion Menu doesn't have that functionality on its own. If so, the issue has to do with your server side code, namely, that it's not generating the correct URLs. Or am I misunderstanding your question?

04-07-2010, 10:44 AM
I don't know.

All I know is, when I use a normal <li> list thus:

<li><a href="~/Folder1/Page1.aspx">Title1</a></li>
<li><a href="~/Folder2/Page2.aspx">Title2</a></li>

the tilde meaning "start at the root directory", the local IIS system generates the correct directory reference to open the correct page when I select one or both choices, as follows:


When I use the same coding within the Accordion Menu setup, the ~ is not removed when the dir ref is generated. So I get


My assumption is that something within the Accordion Menu code is causing a problem. If I remove the ~/ thus:

<li><a href="Folder1/Page1.aspx">Title1</a></li>
<li><a href="Folder2/Page2.aspx">Title2</a></li>

then the first page displays OK as:


but when I the select the second page, the dir ref is generated with the first page's folder also included, as follows:


Again, I can only conclude that the Accordion Menu code is causing the problem.

My system is Windows 7, Visual Studio 2008 SP1, ASP.NET 3.5, built in IIS.

04-07-2010, 08:38 PM
Since the accordion menu doesn't actually make changes to the menu URLs in any way, it's almost impossible for the issue to be the script itself. From your description this still sounds like an issue with your server side code outputting relative URLs that's confusing the browser. Can you instead have the server generate absolute URLs (ie: http://mysite.com/folder1/page1.asp) instead?

Regardless, just to rule out 100% it's not the accordion script meddling with your menu URLs, try temporarily disabling the script on your pages. Simply open up ddaccordion.js, and empty it (remove everything). Then view your pages- do the menu links suddenly work as a result?