Creating the main menu (ASPX)

Now add a dynamic drop-down menu to the master page. You can implement the drop-down menu using either the CMSMenu or CMSListMenu control. The example uses the first option, which is easier to understand if you are not familiar with advanced CSS styles.

If you prefer a drop-down menu based on CSS styles and UL/LI elements, you can try using the CMSListMenu later. See the Controls Reference for additional details and examples.

  1. Edit the MyMaster.master file in Visual Studio.

  2. Remove the <table> element used as a static menu inside the <div class=“MainMenu”> element. Instead, drag the CMSMenu control from the toolbox to this location.

  3. Set the following properties of the CMSMenu control (you can find them in the Behavior section of the Visual Studio Properties window):






    Configures the menu to display pages starting from the root of the site structure.



    Sets a horizontal layout for the menu.



    Allows you to add prefixes before the names of the CSS classes applied to the menu. The ;sub value uses unmodified class names for the main (first) menu level and the sub prefix for the second level and all other sub-levels.



    Specifies the type of mouse cursor displayed when a user hovers over the menu.

  4. Save the changes.

The code of the main menu section should now look like this:

<!-- main menu -->
<div class="MainMenu">
    <cms:CMSMenu ID="CMSMenu1" runat="server" Path="/%" Layout="Horizontal" CSSPrefix=";sub" Cursor="Pointer" />

The master page is now prepared and you can assign it to the site’s ASPX templates. Continue with Developing the Home page (ASPX)

Kentico Controls and Web Parts

Kentico provides a set of flexible server controls in the CMS.Controls.dll library, but large amounts of the built-in functionality are only available through web parts stored in the CMSWebParts folder.

These web parts are standard ASCX user controls and you can use them on both portal engine templates and ASPX pages. To add a web part onto your ASPX pages, drag it from the Solution explorer and set the properties in the Properties window.