Developer forum

Forum » Development » Toolbar button dropdown options

Toolbar button dropdown options

Marco Santos
Reply

Hello.

 

Easy one (I think, even though I can´t find a way): how do I make a context menu appear for a toolbar button (when clicking on the little arrow)?

 

Marco


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Marco

 

You set the ContextmenuId="YourContextMenuID" on your button.

 

 Then you have your context menu like this:

 

<dw:ContextMenu ID="YourContextMenuID" runat="server">
		<dw:ContextMenuButton ID="ContextmenuButton9" runat="server" Divide="None" ImagePath="/Admin/Images/Ribbon/Icons/Small/line-chart.png" Text="Dag" OnClientClick="report('PageviewsDay');">
		</dw:ContextMenuButton>
		<dw:ContextMenuButton ID="ContextmenuButton7" runat="server" Divide="None" ImagePath="/Admin/Images/Ribbon/Icons/Small/line-chart.png" Text="Uge" OnClientClick="report('PageviewsWeek');">
		</dw:ContextMenuButton>
		<dw:ContextMenuButton ID="ContextmenuButton8" runat="server" Divide="None" ImagePath="/Admin/Images/Ribbon/Icons/Small/line-chart.png" Text="Måned" OnClientClick="report('PageviewsMonth');">
		</dw:ContextMenuButton>
	</dw:ContextMenu>

 

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Marco,

 

Take a look at my article series on building Admin interfaces. Part 2 shows an example of this: http://devierkoeden.com/articles/building-dynamicweb-module-admin-interfaces-2-using-the-ribbon-ui-introduction.aspx (in the section RibbonBarButton).

 

Hope this helps,

 

Imar

 
Marco Santos
Reply

Hello.

 

ToolbarButton does not have a ContextMenuId property. Or am I missing something?

 

Marco

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

You are right. That property is on ribbon bar buttons.

 

You need to set the clientclick property to open a context menu:

ContextMenu.show(e, 'YourContextMenuID', '', '', 'BottomLeft', document.getElementById('idOfYourButton'));

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

And set ShowOptions to true for the arrow to appear?

Imar

 
Marco Santos
Reply

Yes, ShowOptions was set, it was just the javascript that I tried first time was not correct.

 

Thanks for the help.

 

You must be logged in to post in the forum