Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, July 4, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: How to enumerate through menus and navbar
Alberto Chiesa
Posts: 49
 
How to enumerate through menus and navbarYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 09 10:57 AM
Hi,
anyone knows a way to traverse the menu and nav bars at runtime?
I.e. I would like to be able to retrieve a list of every navbar (and menu) item at runtime.

A iterable collection of items would be perfect.

Thanks guys!

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to enumerate through menus and navbarYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 09 12:36 PM
Server side or Client Side?

Client Side, you could look into the Generated Output and determine the class of the Menus and Navigation bars. (E.g. the toolbar items IDs are typically prefixed with "Toolbar_")

Server side, you could do so as well. Get access to a Toolbar, but you may need to know the Menu item that you are looking for (using FindMenu) to locate a NavItemCollection. From there you should be able to enumerate the children.

This example is 7.2.x, but I believe it should work on 7.5.x as well:

Sage.Platform.WebPortal.Services.IMenuService mnuSrc = ToolBar.WorkItem.Services.Get();
NavItemCollection ncSchedule = (NavItemCollection)mnuSrc.FindMenu("mnuSchedule");

From here on, I could iterate through the Items collection....


However,
[Reply][Quote]
Alberto Chiesa
Posts: 49
 
Re: How to enumerate through menus and navbarYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 09 12:51 PM
Thanks Raul, it is server side.

The problem is I would like a list of menus and navbar items without any prior knowledge.

In your sample I would need to know that there is a menu called mnuSchedule.

So, I would like to get a list of navbar sections and toolbar menus, then, for each one, a list of items.

Any advice on how to do this?

Thanks a lot!
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: How to enumerate through menus and navbarYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Oct 09 6:25 PM
Alberto,
Here's some code from my menumodule that hides items based on roles/groups/teams:

if (it == ItemType.Menu) // Hiding menu items
{
ToolbarWorkspace toolbar = _parentWorkItem.Workspaces["ToolBar"] as ToolbarWorkspace;
IMenuService menusvc = toolbar.WorkItem.Services.Get();
NavItemCollection mnugrp = menusvc.FindMenu(sGroupList[0]) as NavItemCollection;
if (mnugrp != null)
{
if (sItem == AllItems) // Hide entire menu
toolbar.Controls.Remove(toolbar.FindControl(sGroupList[0]));
else // Just remove the item
mnugrp.RemoveItem(sItem);
}
}

if (it == ItemType.NavItem) // Hiding nav bar items
{
NavWorkspace navbar = _parentWorkItem.Workspaces["NavBar"] as NavWorkspace;
NavItemCollection navgroup = navbar.FindControl(sGroupList[0]) as NavItemCollection;
if (navgroup != null)
{
if (sItem == AllItems) // Hide entire nav group
navbar.Controls.Remove(navgroup);
else // Just remove the item
navgroup.RemoveItem(sItem);
}
}

You can download the whole thing from the partner newsgroups at http://community.sagesaleslogix.com/slsl/board/message?board.id=dev_slx&thread.id=543 (be sure to grab the latest version of the project at the end of the thread), or send me an e-mail direct at mike.laspina@sage.com and I'll send you the project.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/4/2025 10:20:18 AM