CS4 webControl25

CS4 webControl25

Menu25

Menu25 is a dynamic sidebar menu generator designed for hierarchical menu structures. It supports submenu nesting, FontAwesome icons, badges, URL actions, popup navigation and automatic GUID-based path tracking.

MenuItem Class

Represents a single menu item. Each item may contain child menus (submenus).

  • Guid – Unique ID automatically generated if empty.
  • MenuName – Display name of the menu.
  • MenuIcon – CSS class for FontAwesome (or image URL).
  • MenuIconTypeFontAwesome or Url.
  • Info – Badge text (e.g., "New", "5", "Alert").
  • InfoColorType – Badge color:
    • Success (Green)
    • Info (Blue)
    • Warning (Yellow)
    • Danger (Red)
  • Menus – List of child MenuItems (for tree-menu).

AddUrl()

Defines the navigation behavior for the menu item.

AddUrl(string Url, bool NewTab = false, bool Popup = false, int PopupWidth = 500, int PopupHeight = 750)
  
  • Url – Required link to open.
  • NewTab – Opens in new tab (target="_blank").
  • Popup – Opens link inside a popup window.
  • PopupWidth – Popup width. Default: 500px.
  • PopupHeight – Popup height. Default: 750px.

Note: System automatically appends _wtmid=GUID to every URL for tracking.

Icons

Two icon types are supported:

  • FontAwesome – Uses CSS classes (e.g., fas fa-home).
  • Url – A direct image URL.

Info Badges

You can display badges such as "New", "5", "Hot" using:

  • InfoColorType.Success – Green badge
  • InfoColorType.Danger – Red badge
  • InfoColorType.Info – Blue badge
  • InfoColorType.Warning – Yellow badge

Example:


item.Info = "New";
item.InfoColorType = InfoColorType.Warning;

Nested Menus (Tree View)

Menu25 supports unlimited levels of nested menu items. If Menus contains child items, it automatically generates:

  • nav-item has-treeview
  • Expandable submenu (<i class="right fas fa-angle-left">)

GetHtml()

Generates the full HTML list (<li> menu items).


var menu25 = new Menu25();
var html = menu25.GetHtml(rootMenuItem);

Output includes:

  • Menu hierarchy
  • Icons
  • Badges
  • Popups / NewTab links
  • GUID + menu-path comments

LoadMenu()

Uses menu_web HTML layout and injects:

  • #AppName# ? Replaced with application name
  • #ImageUrl# ? User avatar / logo
  • #SideMenu# ? Generated menu content

var html = menu25.LoadMenu(menuRoot, "/images/user.png", "MyApp");

The output is a complete sidebar navigation with branding.

Example Menu Structure


var root = new Menu25.MenuItem();

var dashboard = new Menu25.MenuItem()
{
    MenuName = "Dashboard",
    MenuIcon = "fas fa-home",
};
dashboard.AddUrl("/Home/Dashboard");

var reports = new Menu25.MenuItem()
{
    MenuName = "Reports",
    MenuIcon = "fas fa-chart-line"
};

reports.Menus.Add(new Menu25.MenuItem()
{
    MenuName = "Sales Report",
    MenuIcon = "fas fa-file",
    Info = "New",
    InfoColorType = InfoColorType.Success
});

root.Menus.Add(dashboard);
root.Menus.Add(reports);

var menu = new Menu25();
var html = menu.LoadMenu(root, "/img/logo.png", "MyApp");