K2 Menu System

A flexible Menu/Navigation framework to build SmartForms that have data driven menus. Menus can be configured to have any style based on a library of style that can be customised to your liking.


The following features are included:

  • Build Top and Side style Portal/Dashboard Forms through the use of Template Forms
  • Menu Links that can be configured to point to K2 Forms, Internet Websites or even Click K2 buttons on the K2 Form being displayed.
  • Menu Designer with the following capabilities 
  •      Define Associated Systems to allow grouping Menus/Menu Items together per System
  •      Configure First Level Menu Items with icons 
  •      Configure Second Level Menu Items with icons 
  •      Menu Item Permissions can be set allow only certain users to see certain menu items as well as be used for form level security.
  •      Configure multiple menus per Associated System 
  •      Configure Style (This is the look and feel of a menu) with full capability to specify every aspect of how the HTML and CSS (even JS) is generated 
  •      Import and Export of Styles (This allows you to share your hard work with others) 
  •      Templates (so you can quickly get a new Portal/Dashboard Form going) 
  •      Mobile support with responsive CSS.
  •      Import/Export Associated Systems. This allows you to extract all of the Menus/Styles built for a specific system and import it on another environment.
  • New SwitchDesk Feature allows for seemless navigation between Associated System through the means of a clever overlay menu.

Some notes about the K2MenuSystem and its components:

  • NO Custom Controls. The K2MS uses DataLabels to render the Menus.
  • Uses a custom DB which is seperate from the K2 DB. The DB is deployed as a DataTier Application (or DACPAC) and allows for easy upgrading to future versions of the K2MS without having to redesign any K2 Forms.
  • All Logic for generating Menu HTML is contained within SQL Stored Procedures.
  • Images are primarily embeded via DataURI although any URL location is supported through configuration.
  • This Solution was designed with a minimal K2 dependency footprint to ensure that it is virtually impossible for it to break when upgrading your version of K2. NOTE:This is impossible to gaurantee so always test your solutions on the latest version before upgrading you existing environments.
  • Template Forms are included to assist in building new Dashboard/Menu Forms with either a Top Menu, a Side Menu or Top and Side Menu which allows you to create complex configuration screens.



26 replies

First, this is a really useful tool.  Thank you very much for putting this out there.  


Do you know of a way we can force a save before navigating to the next menu click?  I found the javascript code in the scripts folder but am struggling to find a button on the form/view within the iframe to execute an on click command.  Any help here would be greatly appreciated!


I am having issues with tooltips on IE10. Even though I have the tooltip tickboxes unchecked, a blank box is still being displayed. 


I have looked through the CSS but cant seem to find anything wrong there. Any ideas? 

Thanks for all the comments and my apologies for the late reply, I find myself a little bit busy these days. I am aware of the issue with IE and the tool tips and it is an issue in K2 in general when you change a Data Label's tool tip to a space it disabled the tool tip in all browsers except IE. I will be looking into this for the next release to see if I can work around this. 


@ @klymych - When configuring a Menu Item, you can set the menu item to simulate clicking a button within the form currently loaded into the iFrame. You have to configure the Menu Item to Target a Button based on the Text label displayed on the button (this button could be hidden) and also specify the iFrame in which the form has been loaded. You could then make this button Save your data and navigate to a different form. There is no need for you to be concerned about javascript as this is all handled by the Menu System and you should technically be able to do what you want to do without more javascript injection. (see image below)


If you are having trouble getting the Button Click option to work, please consider the following. Clicking a button in an iframe using javascript has one security restriction, the protocol, port and domain needs to be the same for the source and target Forms. This means that if you load the Menu Form on the URL "https://myk2server.domain.com:444/runtime/runtime/form/MyK2MenuForm" then your target form on which you are trying to click the button should also be loaded into the iframe from a matching protocol, port and domain e.g. "https://myk2server.domain.com:444/runtime/runtime/form/MyApplicationFormWithButton".


I hope this helps

Sir, this is some fine work you have done here.. bravo.. unfortunately, I am having problems with IE11 that will keep me from using this until there is a fix.


I believe this is where the problem occurs, as the height element is using 100%. 

<iframe name="K2MenuSystemMainFrame" id="K2MenuSystemMainFrame" src="MYSITEURLHERE" style="background: none; border-width: 0px; width: 100%; height: 100%;" onload="initK2MenuSystem()"> </iframe>


If i go into the debugger window and set the height to a pixel value (such as 1000px) it displays fine in my test app. Screens work as they should on both Firefox and Chrome, i have tried compatibility mode on ie back to ie 9. IE11 also does not display this frame properly in the menu system designer on my dev box. see screenshots of ie11 behavior. In the out of the box menu designer screen you only get a small scrolling div, and the buttons will not work


Example of proper display on chrome


have you seen this issue on your end in development? I am more than happy to fix the formatting on the solution you provided, if you can point me in the right direction. i tried to add a simple javascript alert to the k2ms.init.js file and it did not display. 

Hi Jtiger121,
Thank you for liking the Menu System. I am sorry to hear that you are having some problems.


What you are describing when you say "only get a small scrolling div, and the buttons will not work" and "tried to add a simple javascript alert to the k2ms.init.js file and it did not display" sounds to me like the "k2ms.init.js" not getting loaded correctly.


The "k2ms.init.js" contains the JavaScript used by the menu system to do two things:
1.Resize the menu system iframes height to fit the current browser size. This is a dynamic size because setting height to 100% does not actually do anything. Coincidently the base HTML generated for the iFrame does have a height value of "100%" in there but this is merely a place holder since the JavaScript function "initK2MenuSystem" is responsible for recalculating the actual hight required every time the window is loaded, resized, ready or scrolled.
2.Provides capability to simulate clicking hyperlinks within iframe pages. This capability is extensively used in the MenuSystem Designer and all of the Menu Items on the Top navigation bar make use of this capability.


What you are describing tells me that these scripts are not working or are unavailable. The most likely cause is that the "k2ms.init.js" is not found or inaccessible on the current SmartForms URL that you are using.  NOTE:If the resizing was working but not the buttons in K2MS Designer then there is another reason but since both are not working and you are seeing height as "100%" this must be the issue.


Here is what you can do to try and get to the bottom of the issue:

1.Make sure that you have copied the "k2ms.init.js" from the installation folder to the following folders on ALL K2 smartforms servers:
1.1.Copy the script to the Runtime scripts folder, e.g."C:Program Files (x86)K2 blackpearlK2 smartforms RuntimeScript"
1.2.Copy the script to the Design scripts folder, e.g."C:Program Files (x86)K2 blackpearlK2 smartforms DesignerScript"
1.3.If you have any additional custom Runtime Folders then you would need to copy this file in the Script folder for those as well.


2.Check in the Browser experiencing the issue if you can load the script file directly by navigating to the following url:


3.Use IE Developer Tools to check if any JavaScript Errors are occurring.


Hopefully the above checks will point you in the right direction.

Kind Regards

On a fresh install of K2 Menu System 0.4 in our staging environment on K2 BlackPearl 4.6.10, all the side menu styles do not load.  Neither do any of the Novak or Switch Desk styles.  Nothing is appearing as errors in server logs or developer tools.  I have tried running the stored procedure to reset but no luck.  I am testing on IE 11 and Chrome 48.  Any thoughts what could be missing from the install?

I ended up setting the ie height to a fixed value in the switch desk html and the css style for the main div's on top menu. Thank again migaelm..


trjones, you may want to check permissions on the database or possibly re-install the dacpac. you can confirm that the top menus load?

My issue was with the "Use Description as Link Tip" or "Use Description as Image Tip" being checked on either the HTML Level1 or HTML Level2.  Once I unchecked those boxes, the OTB styles that weren't working started working.  I did notice that in step 2 on page 4 (5 in the pdf) of the directions it asks you to install files in Runtime directory.  However v0.4 does not contain this directory in the download.  I am not sure if this may be the root cause.  Any way the Tips are not critical for me so I will just not use them.  Otherwise this tool looks very promising.



We're having issues deploying this control and I suspect it's related to database permissions.  When we deploy the package the smart objects seveal of them throw exceptions.  I've added the K2 Balckpearl service account to have database access and my own user (who is running the deployment) but nothing seems to improve it.


Can anyone shed any light?






System.Exception: SmartObject: ''. Inconsistency detected between SmartObject 'K2MenuSystem.MenuItemSets.SmartObject' and Service Object 'K2Menu-MenuItemSets' during loading of SmartObject Definition. Service Object : 'K2Menu-MenuItemSets' not found in Service Instance 'K2MenuSystem' Definition.
---> System.Exception: SmartObject: ''. Inconsistency detected between SmartObject 'K2MenuSystem.MenuItemSets.SmartObject' and Service Object 'K2Menu-MenuItemSets' during loading of SmartObject Definition. Service Object : 'K2Menu-MenuItemSets' not found in Service Instance 'K2MenuSystem' Definition. ---> System.Exception: Inconsistency detected between SmartObject 'K2MenuSystem.MenuItemSets.SmartObject' and Service Object 'K2Menu-MenuItemSets' during loading of SmartObject Definition. Service Object : 'K2Menu-MenuItemSets' not found in Service Instance 'K2MenuSystem' Definition.
at SourceCode.SmartObjects.ServiceBrokerStore.Store.AddServiceInfo(XDocument doc, Boolean throwInconsistentException)
at SourceCode.SmartObjects.ServiceBrokerStore.Store.AddFluff(XDocument doc, Boolean throwInconsistentException)
at SourceCode.SmartObjects.ServiceBrokerStore.Store.GetSmartObject(Guid SOid, Boolean throwInconsistentException)
at SourceCode.SmartObjects.ServiceBrokerStore.Store.GetSmartObject(Guid SOid)
at SourceCode.SmartObjects.Runtime.SmartObjectManagementServer.DeployAssociation(SmartObjectDefinition smartObjectDefinition)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at SourceCode.Hosting.Server.Runtime.HostServerBroker.InternalMarshal(String TypeName, String MethodName, Object[] ParamArray, Boolean[] NullList, Boolean UseSession, String sessionCookie, String RemoteConnectionString)
at SourceCode.Hosting.Server.Runtime.HostServerBroker.SessionMarshal(String TypeName, String MethodName, Object[] ParamArray, String sessionCookie)
at SourceCode.Runtime.Services.SmartObjects.ServerAccessLayer.ExecuteSessionMarshal[t](String serverTypeName, String methodName, Object[] parameters)
at SourceCode.Runtime.Services.SmartObjects.AssociationDeploymentItem.DeployItem(IQueryContext queryContext, Stream stream, ComplexType complexType)
at SourceCode.Runtime.Services.SmartObjects.RuntimeService.Deploy(IDeploymentContext context)
at SourceCode.Deployment.Runtime.ServerSession.BeginDeploy()

We are observing that in IE and only sometimes, on hover produces a blank white box.

Hi jflanigan,

This will be fixed in a future release but here is a workaround you could use.

1. Open up the "k2ms.init.js" file which you copied to "C:Program Files (x86)K2 blackpearlK2 smartforms Runtime" in a text editor like notepad.

2. Add "$('span[name="Page HTML"]').attr("title",'');" (excluding the outer quotes) to the third line of this file so that the top of the file looks as follows:


var hasLoaded = false;

function initK2MenuSystem(bottomOffset){

$('span[name="Page HTML"]').attr("title",'');



bottomOffset = -5;


3.Save the file and perform an IISRESET.

4.Reload your Form and the whiteblock tooltip should now be gone on any menu forms.

Hi Migael


Nice work!


I would like to add application logos, search textboxes, etc. to the forms. How do I go about that?



Murray Macdonald

 Hi Migaelm,


I just use your K2 Menu System. Thank you for your great work.


But I was found it's load a long time. After I use dev tool to debug network transaction. 

It's load the default page twice (you can see it's the same transaction in red circle).


Please give me some advice.


Hi All,


Does anyone know if this control is supported by K2 version 4.7?




Yes the K2 Menu System works on K2 4.7 and if you have K2MS installed on a previous version of K2 you wont have any issues when upgrading. There is however an issue installing K2MS v0.4 on a newly installer K2 4.7. This issue is resolved in the new minor version K2MS v0.4.1 which is now available. There are lots of other fixes on the way which arent included in this version so please look out for some more updates in comming weeks.



I have a error message when I launch the K2 Menu System Management.




I solved my previous problem, but now I have another one.
After copying the "TopMenuTemplate" form and reconfiguring the rule, when my form appears I have two menus that appear.


After deployment, I tried to open and clicked each menu. But it did not show anything. Please help.




We started to receive this error when loading the forms using the menu system in our dev/staging environment.  No changes were made to the menu systems/forms themselves...any ideas on what would cause this particular issue?


SmartObject property QueryStringParameters is a required property for selected method List_1. Value must be set.



I want to use the permission in Menu Items.


I make the K2MenuSystem.UserMemshipsCheck.ItemView on Visible for verify the groups for my user.

But, when I add a new group for my user, in K2MenuSystem.UserMemshipsCheck.ItemView the new group not appear and my user can't see the Menu Item use this group in permission.


However, after 24h, the new group appear ???


Can you help me ?

Hi Stephane, 

The K2 Identity Cache table in the database is only refreshed every 24 hours

You can force it to refresh with the SQL code supplied by Sourcecode here: https://help.k2.com/onlinehelp/k2blackpearl/icg/4.6.4/webframe.html#refresh_usermanager_cache.html





Im using the K2 menu system as an application form in the mobile app.  The only issue is that it breaks the barcode control which only works in the mobile app.  Any ideas or suggestions?





Much appreciated on the menu subsystem developed.  I've followed the instructions given in the PDF inside the zip file, and installed it on a K2 4.7 system.  Everything works fine except that I cannot add anything, similar to the user Surakarn's reported above.  

i've installed it on a new database (K2MS), my main database for K2 is "K2" and our subsystems are all inside yet another one (i.e. POMS).

Hi everyone, 


How can I navigate to one of form with specific menu tab?


In my K2 workflow, I have an email event that notifies a group of people to come back to the form and do approval process.

but seem like the only way to navigate to k2 menu system is "Form/K2MenuSystem".


I have tried many different scenarios one of then would be including the "Menu Item ID" at the end of URL, but the item ID is different on another computer.



thank you for helping and look forward to any reply 





Can we implement the highlight menu so that user know which pages they are opening from the menu?


Best Regards