gizgok
gizgok

Reputation: 7639

Is it possible for a css class to work with asp:Menu control in .net 2.0

I'm working on a migration of classic asp site to asp.net 2.0. There's a piece of CSS code associated with a div which I want to be used for an asp:Menu Control. I've tried various permutations but can't get figure it out. The css is as follows:

.class{
  color: black;
  background-color: #A1A6AB;
  border: thin solid black;
  position: absolute;
  top: 1;
  width: 140;
  text-align: center;
  font: 9pt;
  z-index: 2;
  padding: 1;
  cursor: pointer;
  cursor: hand;
}

This needs to be associated with asp:Menu. Is it possible to do this?

Upvotes: 1

Views: 185

Answers (3)

gizgok
gizgok

Reputation: 7639

The closest possible that I've come to get the same feel and look is by adding the css properties directly through style in the asp:Menu.

Upvotes: 0

villecoder
villecoder

Reputation: 13483

There's a property of the menu control called CssClass. You can try that to start with and that will set the class for the entire menu when it is rendered to the browser.

There are also more granular styles, each with a CssClass property you can modify. They are

  • DynamicHoverStyle
  • DynamicSelectedStyle
  • DynamicMenuStyle
  • DynamicMenuItemStyle
  • LevelMenuItemStyles
  • LevelSelectedStyles
  • LevelSubMenuStyles
  • StaticHoverStyle
  • StaticMenuItemStyle
  • StaticMenuStyle
  • StaticSelectedStyle

Use these properties to your advantage.

Upvotes: 1

IrishChieftain
IrishChieftain

Reputation: 15253

Here's some sample CSS for a Menu control, including fix to stop it jumping in Firefox:

http://codersbarn.com/post/2009/07/30/Fix-for-TreeView-Jumping-in-Firefox.aspx

Upvotes: 0

Related Questions