ASPX templates
Version 5.x > ASPX templates > Combining Two CMSListMenus View modes: 
User avatar
Member
Member
eric.rovtar - 2/27/2011 6:19:00 PM
   
Combining Two CMSListMenus
Hi!

I'm trying to create a drop-down menu that will combine documents from two locations. The first location is a static path (/Resources/%), and the second will be dynamic, based on a variable (/<Campus>/Resources/%).

The problem is, this creates two unordered lists. I'd like them to be in one, with a separator element. So instead of:


<ul><li .... </li></ul><ul><li .... </li></ul>


I'd like:

<ul><li .... </li><li class="separator"><img src="separator.png" /><li .... </li></ul>


Thanks!

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 3/1/2011 7:56:53 AM
   
RE:Combining Two CMSListMenus
Hello Eric,

Could you explain how you're rendering that markup? are you using a usercontrol?

User avatar
Member
Member
eric.rovtar - 3/1/2011 9:25:58 AM
   
RE:Combining Two CMSListMenus
Well the work around I came up with yesterday was to use two QueryRepeater, and create a MenuItem transformation:
<cms:QueryRepeater ID="rResources"
QueryName="cms.menuitem.selectdocuments"
TransformationName="cms.menuitem.menuitem"
Columns="MenuItemName, NodeAliasPath, DocumentUrlPath, DocumentMenuRedirectUrl"
WhereCondition="NodeAliasPath LIKE '/Resources/%' AND NodeLevel = 2"
OrderBy="NodeLevel, NodeOrder, NodeName"
runat="server">
</cms:QueryRepeater>


<li class="CMSListMenuLI">
<a href="<%# GetNotEmpty("DocumentMenuRedirectUrl;DocumentUrlPath;NodeAliasPath") %>"><%# Eval("MenuItemName") %></a>
</li>


I add the second one dynamically from the code-behind at PageLoad. To solve look in a specific path and tree depth, I do "NodeAliasPath LIKE '%/Resources/%' AND NodeLevel = 2":
CMS.Controls.QueryRepeater qrResources = new CMS.Controls.QueryRepeater();
qrResources.QueryName = "cms.menuitem.selectdocuments";
qrResources.TransformationName = "cms.menuitem.menuitem";
qrResources.Columns = "MenuItemName, NodeAliasPath, DocumentUrlPath, DocumentMenuRedirectUrl";
qrResources.WhereCondition = String.Format("NodeAliasPath LIKE '/Campuses/{0}/Resources/%' AND NodeLevel = 4", CurrentCampus);
qrResources.OrderBy = "NodeLevel, NodeOrder, NodeName";
qrResources.HideControlForZeroRows = true;

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 3/2/2011 5:47:34 AM
   
RE:Combining Two CMSListMenus
Hello Eric,

There are several ways to solve this problem.

1. Create a custom query that combines your two sql selections into one statement to unify the data it returns.

2. Use the TreeProvider class to create your own where statement property to again unify all the date it returns.

If you have questions regarding any approach, please let us know!