-[Danny Chen]- Blog of an ASP.NET QA tester

Tips and info about Site Navigation, ImageMap, Menu and other cool ASP.NET v2.0 features.

Menu Control doesn't work after migrating from VS2003 and ASP.NET 1.1

I noticed this issue quite a bit on the forums.  A lot of users are finding that after moving their ASP.NET 1.1 site to ASP.NET 2.0 and then adding a Menu Control to their app, the Menu doesn't work. 

The reason this doesn't work is that an extra tag was added to web.config <xhtmlConformance mode="Legacy" />  This flag was meant for 2.0 to act a lot more like 1.1 and one of the major differences is the naming convention of controls.  This naming change causes the quirky behavior with Menu in IE.

There are 2 fixes for this issue:

1) Remove the xhtmlConformance tag from web.config
Personally if you can do it, I recommend this option.  If you're using ASP.NET 2.0 features, you should try and stick with the new rendering modes.

2) If you can't do #1, then give your masterpage an ID
To do this, add a line to your Page_Load for your Masterpage:

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ID = "Master1";
    }
}

Comments

Todd said:

Thanks for the above solution.
I've been fighting this for hours. Wa La....it works.
# January 6, 2006 3:46 PM

Jeff said:

Brilliant - I was going to be mighty cranky if this wonderful masterpage concept turned out to be completely useless. Thanks guys
# January 9, 2006 11:11 PM

Rajesh Vartak said:

Thanks a lot, i have been fighting a lot for this
# January 11, 2006 12:33 AM

Paul Talbot said:

You sir are an absolute star! Have struggled with this for the last 2 hours!
# January 12, 2006 9:26 AM

Walter said:

Thank you so much! Like others, I have been fighting this one for a few hours. Whew!
# January 15, 2006 9:39 AM

Ed said:

This still doesn't work for me.  I tried both of the solutions mentioned above and I still can't get the sub menus to open up.  I also have a strange error that says "'tagName is null or object not defined'".  I don't know if that has something to do with it or not.  Any other suggestions?

# October 12, 2007 10:22 AM

Mike said:

Danny - I also ran into this issue and determined that the offending tag was the issue.  Thanks for offering an alternative solution, and confirming the problem.

# October 23, 2007 12:08 PM

Juan said:

Danny, I stumbled across this little snippet while struggling for hours to solve this on my own to no avail. This was an error brought up by a client of mine still on IE6. You sir saved my backside.

# February 19, 2008 9:21 AM

Nick said:

Thanks for this tip. I was about to give up and build my own menu control. You'd think this would be better documented. I spent ages trying various hacks on the CSS which all had no effect. I removed this from the config and then IE6 started behaving exactly the same as Firefox (correctly).

# July 6, 2008 8:42 PM

Simon said:

Thanks very much for this!

Been fighting with this in IE6 for about 2 hours now.

# July 22, 2008 10:40 AM

Thomas said:

Have you tried to use a z-index style equal to 5 or less ?

It works with IE 6, 7 and 8 but not with Firefox. Do you have any idea ?

# December 5, 2008 5:46 AM

@nЮé$ said:

Hi.. it worked for me with the first option. Thanks a lot. Blessing

# September 8, 2009 4:49 PM

HKTraz said:

Thaks a lot!!!!

Removing the "<xhtmlConformance mode="Legacy" />" in the web.config solved the rendering problem under IE6.

Bravo

# December 21, 2009 11:54 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)