Question
· Mar 7, 2016

How to get key value from dropdownmenuitem on Zen Mojo Bootstrap?

I would like to know how to get the key value from a dropdownmenuitem placed on a navbar.

I have tried to get from onselect and onchange events of the template class, but it didn´t  work.

According to the snapshot attached I am trying to retrieve the values from 'action-1' and 'action-2'. 

I have attached a ZIP file with a snapshot which value I am trying to retrieve and example classes.

Thanks.

Discussion (8)1
Log in or sign up to continue

As temp  solution you can use href:"javascript:zenPage.StartEvent('yourkey','onclick','yourvalue');"

In your Zenpage add following ClientMethod to call events (sometimes useful for handling zen-events with bootstrap-plugins):

 

ClientMethod StartEvent(
key,
eventType,
value) [ Language = javascript ]
{
var newArea "events-" key.split(":")[0];
if (zenPage.currArea!==newArea) {
zenPage.currArea newArea;
zenPage.loadTemplateNS(zenPage.templateDispatchBaseNamespace+"/events",key.split(":")[0],newArea);
}
var st zenPage.getTemplate();
st[eventType](key,value,'mainView');
}

That should do it for both types:

ClientMethod StartEvent(
key,
eventType,
value) [ Language = javascript ]
{
if (zenPage.templateDispatchMode) {
var newArea "events-" key.split(":")[0];
if (zenPage.currArea!==newArea) {
zenPage.currArea newArea;
zenPage.loadTemplateNS(zenPage.templateDispatchBaseNamespace+"/events",key.split(":")[0],newArea);
}
}
var st zenPage.getTemplate();
st[eventType](key,value,'mainView');
}