[Last Call] Learn how to a build a cloud-first strategyRegister Now


StaticMenuItemStyle Border Thickness

Posted on 2006-03-20
Medium Priority
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
  • 3
  • 3
LVL 12

Expert Comment

ID: 16238205
it's because you're setting the borderstyle on the menu items rather than the menu collection.

Author Comment

ID: 16238276
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

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

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 16238591
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

ID: 16238688
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.

Author Comment

ID: 16239349
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

GranMod earned 0 total points
ID: 16475880
PAQed with points refunded (250)

Community Support Moderator

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

834 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