Menu
IMPORTANT: Starting with Release 8.6, the Menu server control was replaced by the FrameworkUI: <ektron:MenuView> templated server control. If you are already using the Menu server control, you can continue to do so, but Ektron recommends using current versions of functionality.
The Menu server control calls a menu to be displayed on a page. Using the Menu server control, you can manipulate a menu by using the DisplayXslt
property. Below is a menu display with the SampleMenu XSLT.
Before you can use the Menu server control, you must create a menu in the Workarea.
Inserting the Menu server control onto a page
Prerequisite
You must have installed the server controls. See Installing server controls into Visual Studio Toolbox.
- In Visual Studio, choose View > Toolbox.
- Click the Ektron server control tab to display the server controls.
- Drag the Menu server control and drop it into the desired location on the page.
NOTE: You also can place the cursor on the page where you want the server control, then double click the server control that you want.
<CMS:Menu ID="Menu1" runat="server" />
- Click on
Menu
in the code to display and modify the control’s properties using the Properties window of Visual Studio. The page is updated as you modify the property values.
Menu properties
The following are Ektron-specific server controla server control uses API language to interact with the CMS and Framework UI to display the output. A server control can be dragged and dropped onto a Web form and then modified. properties. For information about native .NET properties such as font, height, width and border style, use Visual Studio® help.
- CacheInterval (Double)
The number of seconds that a server controla server control uses API language to interact with the CMS and Framework UI to display the output. A server control can be dragged and dropped onto a Web form and then modified.’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See also: Caching with server controls.
- DefaultMenuID (Long)
The ID of a menu that appears where you insert this server control if no other menu is identified or available. If you don’t know the ID number of the menu, use the CMS Explorer to browse to it.See also: Browsing your Ektron site using CMS Explorer
- DisplayXslt (String)
The XSLT to use to render the menu.
- None. Databind only
- SampleMenu. A sample display, formatted as a bulleted menu list
- TreeMenu. A sample display, formatted as a folder tree. You can expand the tree by clicking on the folder icon.
- Path to Custom Xslt. If desired, enter a relative or absolute path to an Xslt that determines the display of the page.
For more information on using the SampleMenu and TreeMenu DisplayXslt, see Using DisplayXslt samples.
WARNING! Files stored in the
siteroot\Workarea
folder are overwritten (or deleted) when you upgrade Ektron. To avoid problems, copy the default file to a folder outside thesiteroot\workarea
folder then edit it. If there is no default file, create the file outside thesiteroot\workarea
folder. Next, in this property, enter the path to that file relative to the site root folder. - DoInitFill (Boolean)
By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.
- DynamicParameter (String)
Select menu_id. When you do, this server control uses the menu passed as a URL parameter.
- Hide (Boolean)
Hides or displays the output of the control in design time and run time.
- True. Hide the control output.
- False. Display the control output.
- Language (Integer)
Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).
For more information, see Creating a Menu in Another Language.
- Stylesheet (String)
Specify the path to a style sheet for use with this server control.
Leave blank to use the default style sheet.
To use a custom style sheet, place it in a folder outside the
siteroot\workarea
folder then edit it. Next, in this property, enter the path to the custom style sheet relative to the site root folder.The default style sheet is
\webroot\siteroot\Workarea\csslib
. - SuppressAddEdit (Boolean)
- True. Suppress the Add and Edit buttons when a user is logged in.
- False. Show the Add and Edit buttons when a user is logged in.
The default is False.
- SuppressWrapperTags (Boolean)
Suppresses the output of the span/div tags around the control.
- True. Suppress wrap tags.
- False (default). Allow wrap tags.
- WrapTag (String)
Lets a developer specify a server control’s tag.
- Span (default). Designate an inline portion of an HTML document as a span element.
- Div. Apply attributes to a block of code.
- Custom. Lets you use a custom tag.
Using DisplayXslt samples
Two DisplayXslt samples are provided with the Menu server control, SampleMenu and TreeMenu. This section explains how to use them.
WARNING! Files stored in the siteroot\Workarea
folder are overwritten (or deleted) when you upgrade Ektron. To avoid problems, copy the default file to a folder outside the siteroot\workarea
folder then edit it. If there is no default file, create the file outside the siteroot\workarea
folder. Next, in this property, enter the path to that file relative to the site root folder.
SampleMenu
The SampleMenu DisplayXslt lets you display an Ektron menu as a bulleted item list. See below for an example.
When you are logged in to your Ektron site, 2 menu items are added to each section of the menu: Add and Edit Menu. The user can use these to add a new menu item or edit an existing one. See example below.
For information on a adding or editing a menu item, see Adding a Menu Item.
TreeMenu
The TreeMenu DisplayXslt lets you display an Ektron menu as a clickable folder list. You can expand and collapse the menu by clicking on the folder icons.
When you are logged in to your Ektron site, 2 menu items are added to each section of the menu: Add and Edit Menu. The user can use these to add a new menu item, or edit an existing menu item. See example below.
For information on a adding or editing a menu item, see Adding a Menu Item.
NOTE: When using the TreeMenu server control with Visual Studio and Windows 2003, the folder images do not display during design-time. They do, however, display correctly during run-time.
Retrieving the XML structure of a menu
Retrieving a menu's XML structure provides greater control over developing XSLs. The following is an example of how to retrieve the XML structure:
- Open a new Web form.
- Drag and drop a Menu server control onto it.
- Set the
DefaultMenuID
properties. - Drag and drop a textbox on the Web form.
- Set the
TextMode
property to MultiLine. - Set the width of the text box to at least 400px.
- On the code-behind page, add the following line.
Textbox1.Text = Menu1.XmlDoc.InnerXml
- Build the project.
- View the Web form in a browser.
- The XML structure of the menu appears in the textbox.