Onca
Onca

Reputation: 1135

ASP.net MenuBar

I created a regular menu inside the Site master that contains links and another expanded MenuBar:

<div id="menu">

        <div class="MenuBar">
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            <asp:Menu ID="menuBar" runat="server" Orientation="Vertical" Width="100%">
                <DynamicHoverStyle CssClass="DynamicHover" />
                <DynamicMenuItemStyle CssClass="DynamicMenuItem" />
                <DynamicSelectedStyle CssClass="DynamicHover" />
                <StaticHoverStyle CssClass="staticHover" />
                <StaticMenuItemStyle CssClass="StaticMenuItem" ItemSpacing="1px" />
                <StaticSelectedStyle CssClass="staticHover" />
            </asp:Menu>
        </asp:ContentPlaceHolder>
    </div>


    <ul>
        <li class="current_page_item"><a href="#">ח</a></li>
        <li><a href="#">א</a></li>
        <li><a href="#">ה</a></li>
        <li><a href="#">ב</a></li>
        <li><a href="#">ב</a></li>
        <li class="last"><a href="#">חו</a></li>
    </ul>
</div>
  1. why isn't the MenuBar shown when I open my default page? the default page code is just:

    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
  2. How can I insert the Menu Bar to be in the same line with the other links in the main menu ?

Upvotes: 1

Views: 5616

Answers (1)

ronen
ronen

Reputation: 1490

The MenuBar should be outside of the asp:ContentPlaceHolder:

<div class="MenuBar">
<asp:Menu ID="menuBar" runat="server" Orientation="Vertical" Width="100%">
            <DynamicHoverStyle CssClass="DynamicHover" />
            <DynamicMenuItemStyle CssClass="DynamicMenuItem" />
            <DynamicSelectedStyle CssClass="DynamicHover" />
            <StaticHoverStyle CssClass="staticHover" />
            <StaticMenuItemStyle CssClass="StaticMenuItem" ItemSpacing="1px" />
            <StaticSelectedStyle CssClass="staticHover" />
        </asp:Menu>
</div>
<div id="menu">
 <ul>
    <li class="current_page_item"><a href="#">ח</a></li>
    <li><a href="#">א</a></li>
    <li><a href="#">ה</a></li>
    <li><a href="#">ב</a></li>
    <li><a href="#">ב</a></li>
    <li class="last"><a href="#">חו</a></li>
</ul>
</div>


    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>

In order to show both MenuBar and the ul in the same line, they both have to be the style:

display: inline;

Upvotes: 1

Related Questions