help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Customizing the Top Menu

User should be able to call our overview and detail pages. Lets extend the top menu and add our links there.

Our overview page can be accessed under the url:

.../AxCMSweb_Sample/Extras/ArticleOverview.aspx


Our detail page can be accessed under the url:

.../AxCMSweb_Sample/Extras/ArticleDetail.aspx


But we of course want to integrate it into the top menu, so the user could find it faster. Top menu has a simple extention for that:

We need to extend TopMenuModel class with needed URL's.

TopMenuModel has 2 needed methods:

  • GetEditMenuItems– Creates a list of links for "Edit" menu
  • GetNewMenuItemsCreates a list of links for "New" menu

So we will extend TopMenuModel class and override this 2 methods, get default list and add there our links.

GetNewMenuItems will look like:


01 
02 
03 
04 
05 
06 
07 
08 
09 
10 
public override List<UxDropDownItemGroup> GetNewMenuItems()
{
    List<UxDropDownItemGroup> groups = base.GetNewMenuItems();
            
    var itemList = new List<UxDropDownItem>();
    itemList.Add(new UxDropDownItem { Name = "Article", URL = CMSConfigurationSettings.RootUrl + "/extras/ArticleDetail.aspx" });
    groups.Add(new UxDropDownItemGroup { Items = itemList });

    return groups;        
}

And GetEditMenuItems will look like:

01 
02 
03 
04 
05 
06 
07 
08 
09 
10 
11 
public override List<UxDropDownItemGroup>  GetEditMenuItems()
{
    List<UxDropDownItemGroup> groups = base.GetEditMenuItems();

    var itemList = new List<UxDropDownItem>();
    itemList.Add(new UxDropDownItem { Name = "Articles", URL = CMSConfigurationSettings.RootUrl +"/extras/ArticleOverview.aspx" });
    groups.Add(new UxDropDownItemGroup { Items = itemList });


    return groups;        
}

Then we will need to add our new top menu class to web.config for MS prt so CMS will know about it.






<appSettings>

   <add key="TopMenuModelClass" value="PremiumSample.BL.PremiumSampleTopMenu, PremiumSample.BL"/>

</appSettings>

And now our menu will look in browser like:


 

Next article: Adding Publish, Delete and Recover Activities