We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

StaticMenuItemStyle Border Thickness

tekchic
tekchic asked
on
Medium Priority
1,505 Views
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" />
    <Items>
        <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>
        </asp:MenuItem>
    </Items>
    <StaticHoverStyle  Font-Underline="true" BackColor="#F3F7DE" ForeColor="Black" />
</asp:Menu>
Comment
Watch Question

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

Author

Commented:
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.

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

Author

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

Commented:
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:

.menuitemstyle{
      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

Commented:
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.
Commented:
PAQed with points refunded (250)

GranMod
Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.