StaticMenuItemStyle Border Thickness

Posted on 2006-03-20
Last Modified: 2013-12-03
I would like a 1px border around my menus to make them stand out, but the borders multiply between menu items.

For example, if it's a 1px border, it's fine on top/sides/bottom, but in between the top menu item and the one below it, that border doubles to 2px.

Anyone know if there's an attribute I'm not setting?

Here's the code for my menu control.

<asp:Menu ID="Menu1" runat="server" BackColor="#fcfdf5" DynamicHorizontalOffset="2" Font-Names="Arial, Helvetica" Font-Size="11px" ForeColor="#666666" StaticSubMenuIndent="12px" Width="195px">
    <StaticMenuItemStyle BackColor="#F3F7DE" HorizontalPadding="5px" VerticalPadding="2px" BorderColor="#D3D9B5" BorderWidth="1" />
    <DynamicHoverStyle BackColor="#F3F7DE" ForeColor="Black" />
    <DynamicMenuStyle BackColor="#fcfdf5" />
    <StaticSelectedStyle BackColor="#F3F7DE" />
    <DynamicSelectedStyle BackColor="#F3F7DE" />
    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="3px" />
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Reconcilement" Value="Reconcilement" NavigateUrl="~/PageControls/Reconcilement.aspx"></asp:MenuItem>
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Exception Management" Value="Exception Management" NavigateUrl="~/PageControls/ExceptionManagement.aspx"></asp:MenuItem>
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Disputes" Value="Disputes" NavigateUrl="~/PageControls/Disputes.aspx">
            <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="ATM" Value="ATM" NavigateUrl="~/PageControls/ATM.aspx"></asp:MenuItem>
    <StaticHoverStyle  Font-Underline="true" BackColor="#F3F7DE" ForeColor="Black" />
Question by:tekchic
    LVL 12

    Expert Comment

    it's because you're setting the borderstyle on the menu items rather than the menu collection.
    LVL 4

    Author Comment

    If I put it up on the <asp:Menu> tag, it puts a border around all the items, but not the item individually.  I'd like a border around each clickable menu, but not doubled size-wise in between items.  Is this possible?

    Thanks for the quick response.  I'm really new to ASP.NET 2.0 nav controls.
    LVL 12

    Expert Comment

    does the menu control have a gridlines attribute? if so, you could just set GridLines="Horizontal".
    LVL 4

    Author Comment

    None.  There is a CssClass attribute.  I might have to figure out how to use that and apply a stylesheet.  Seems like overkill.
    LVL 12

    Expert Comment

    better idea, use the border setting on the menu tag, then assign a CssClass to the items. call it menuitemstyle or something like that. then in your stylesheet:

          border-top: 1 Black;

    this will put a line at the top of each menu item cell. you can also put all your font settings in there. definitely not overkill.
    LVL 4

    Author Comment

    Apparently there's an attribute I overlooked: "SeparatorImageUrl" for each individual menu item.  I created a "line" and called that "bottomSep.gif", and that works for getting the lines in between each item.  It's *almost* what I'm looking for, but for now it'll do.

    <asp:MenuItem SeparatorImageUrl="~/Graphics/bottomSep.gif" ImageUrl="~/Graphics/nav_off.gif" Text="Reconcilement" Value="Reconcilement" NavigateUrl="~/PageControls/Reconcilement.aspx"></asp:MenuItem>

    Thanks for the help, craskin.  I tried making the border-top css class, but it didn't appear to pick it up in the browser.  It could be that the ASP.NET menu is overlaying the entire top level, maybe a z-index might fix it.

    I guess for now I'll work with the "SeparatorImageUrl" on the <asp:MenuItem> element, and on the <asp:Menu> element I can use "StaticTopSeparatorImageUrl" to get the line going along the top of the menu.

    Accepted Solution

    PAQed with points refunded (250)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now