help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Customizing TopMenu

The information found in this article applies to version 8.6 and below. To read about top menu customization in 9.0 and above read here.

It is possible to customize the Management System’s TopMenu component by adding/changing navigation items. This feature is useful if you want to extend the functionality of the or just rearrange the default navigation structure.

There are three ways to change the structure of the TopMenu’s navigation tree.
You can:
a) describe new navigation items in the project’s Web.config file;
b) add custom navigation tree by developing sub controls for the TopMenu component;
c) change the functionality of the TopMenu component by modifying the AxTopMenu.ascx file;

All the three options are covered in the following sections and a step-by-step guide (about developing sub controls for the TopMenu) is available here.

Describing navigation items in the project’s Web.config file

There can be a section <CustomNavigation>in the system’s configuration file. New navigation items can be described in the following way:

   <a href="http://localhost/AxCMSWeb">AxCMS Home</a>
   <a href="" target="newwindow">Gemini</a>
   <a href="http://localhost/AxCMSWebLive" target="newWindow">Live System</a>

<A>-element’s attributes:

href: absolute URL of a location;

- target: optional attribute to specify that the link should be opened in a new window (value can be only "newwindow");

Adding new navigation items this way is the easiest way to customize the navigation tree, however, Axinom does not encourage you to use this approach: <CustomNavigation> section is supported only for backward compatibility reasons and you shouldn't use it.

Developing sub controls for the TopMenu

Using sub controls for customizing the TopMenu is the most accurate way for extending the navigation tree and Axinom suggests that you use this approach.
There are some strict limitations for defining the TopMenu sub controls:
a) all the sub controls must be children of the AxCMS.Templates.TopMenu.AxTopMenuCustom component;
b) all the sub controls must inherit from System.Web.UI.UserControl;
c) if you change the templates projects’ assembly file, you must always overwrite the same file in the Management System’s bin-folder;

Step-By-Step instructions about using that approach are available here

Examples: Inside AxTopMenuCustom.ascx:

<%@ Register TagPrefix="AxMC" Namespace="Axinom.Framework.UI" Assembly="Axinom.Framework" %>
<%@ Register TagPrefix="AxStyles" TagName="TopMenuStyles" Src="../../admin/TopMenu/AxTopMenuStyles.ascx" %>
<%@ Register TagPrefix="AxContainer" TagName="TopMenuContainer_Home" Src="AxTopMenuContainer_Home.ascx" %>

<!-- START: MenuButton & dropdown -->
   <ButtonTemplate> </ButtonTemplate>
      <!-- START: MenuContainer content -->
      <!-- TopMenu-specific style information -->
      <AxStyles:TopMenuStyles runat="server" />

      <AxContainer:TopMenuContainer_Home runat="server" />

      <!-- END: MenuContainer content -->
<!-- END: MenuButton & dropdown -->

Inside AxTopMenuContainer_Home.ascx:

   <td height="100%" valign="top">
      <!-- START: hyperlinks -->
         CssClass="options" />
         NavigateUrl="" />
      <!-- END: hyperlinks -->

Inside AxTopMenuContainer_Home.ascx.cs

protected HyperLink _hyperlinkHome; 

private void Page_Load(object sender, System.EventArgs e)
_hyperlinkHome.NavigateUrl =

AxMenuContainer is a component for displaying the menu items at the TopMenu. It has two parts:
a) menubutton;
b) dropdown container;

Menubutton is described inside <ButtonTemplate>-tag and it can be any kind of HTML code.
Contents of dropdown container can be described between <MenuTemplate>-tags and it can be also any subset of HTML code.
It is recommended (although not compulsory) to define the contents of the dropdown container inside a different sub control. Doing so gives you the opportunity to involve codebehind files into the composition of dropdown container. Like in the previous example, where AxTopMenuContainer_Home sub control defines two hyperlinks and the first one’s NavigateURL property is set at the codebehind.

It is possible to define several AxMenuContainer components inside  AxTopMenuCustom.ascx control. Each AxMenuContainer’s position on the web page is determined by Top and Left properties. You have to take care that those components do not overlap each other.

Please read the documentation for more information on AxMenuContainer.

Modifying AxCMS.AxCMSweb.admin.TopMenu.AxTopMenu component

If the previous example doesn’t meet your needs, you have also the opportunity to modify AxTopMenu.ascx file under the Management System’s project. However, it is highly recommended that you do not do it. Axinom doesn’t carry any responsibility for problems which may occur by changing the file mentioned above. You should also consider that by changing the described file, you will lose the ability to upgrade your system’s TopMenu component.