ASP Menu controls aren’t rendering correctly in google chrome

“ASP Menu controls aren’t rendering correctly in google chrome”

I did a search for this exact phrase about a month ago to solve a quirky problem that I encountered while using the built in asp:menu control that was introduced with version 2.0 of the framework.

I could go into a long explanation of how difficult it was to find the solution to my problem but instead of doing that I am simply going to give you the solution, that’s all I wanted when I went searching and it took a long time to get it so here dear reader is the solution for you.

To the asp:Menu control render correctly in chrome (or safari) paste the following bit of code in your Page_Load event on every page that you use the control

        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
            Request.Browser.Adapters.Clear();

or grab it on snipt.org

This entry was posted in c#, development, personal, programming, work. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>