ASP: menu in IE8

Source: Internet
Author: User

I 've been using IE8 beta 2 since sometime in August. as soon as I had downloaded it, I raced to my sites to see if there were any issues caused by the new browser's strict adherence to standards. i'm pretty conservative when it comes to my page and control design, so I didn't have CT too has issues. unfortunately, most of our sites rely on the ASP: Menu Control to provide navigation. the first thing I noticed was that I cocould no longer see the dynamic menu items when hovering over the menu. this is a pretty serous problem because that's the main way users navigate around the site. I did some basic googling and searching on the ASP. net forums, and there were quite a number of people with the same problem, but there didn't seem to be an obvious solution.

needless to say, ever since then I 've been eagerly anticipating the IE8 release candidate in hopes that this issue woshould just fix itself. well, the release candidate just hit yesterday and it turns out the issue with the ASP. net Menu Control wasn' t resolved. i'm sure the breakage was the result of a change to make the browser more standards compliant. of course that's a good thing, but it's still annoying that I will have to fix old code to account for new browser changes.

As it turns out, the fix is really straight forward. I 'd like to thank the original poster and the folks at Microsoft connect for posting enough information on this post to get me started. when the menu is rendered, a script resource is wrongly ded on the page that contains a function called popout_show. the function detects and sets the Z-index property of the panel containing the dynamic menu items. the problem is the value for the Z-index is calculated differently depending only on whether or not the browser is IE, not which version of IE. thus, the Z-index calculations for IE were assuming that the element. currentstyle. zindex property wocould return a numeric value, but in IE8, unless the Z-index for these elements has been specified (in a stylesheet or somewhere), the return value is "Auto ".

I had originally toyed around with using script to adjust the Z-index values. that involved swapping in a new popout_show function to append additional logic to account the "Auto" value. after I took a second look at it, I realized the same thing cocould be done using only CSS which seemed like a much better solution. it turned out that all that was really needed was to create or modify a CSS class that includes des a z-index value of at least 1, then assign the class to the menu's dynamicmenustyle property. the CSS class wocould look something like this:

. Adjustedzindex {
Z-index: 1;
}

And the resulting menu looks something like this:

<Asp: menu id = "menu1" runat = "server">
<Dynamicmenustyle cssclass = "adjustedzindex"/>
</ASP: menu>

You may have to set your Z-index to be something higher (for example, if your menu was contained in an element that already had a z-index greater than 1 ), but this worked for me. I hope this is a help to those who have run into the same issue. good luck with IE8-my experience so far has been great!

If you're interested in the script solution, just let me know and I'll post it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.