Asp.Net Menu not rendering correctly in Google’s Chrome

Thought I’d make a quick blog post on this as it’s issue that took me a while to work out.

Symptoms

Basically if you use a ASP:Menu control in your Web application this might not render correctly in certain browsers, most notably Google’s Chrome. In addition to the physical appearance when clicking on a menu option the entire menu disappeared.

Cause

This is caused by .net not determining the capabilities of certain browsers and as a consequence renders the menu with just the basic of features.

Solution

To solve this you will need to tell .net the capabilities of the browser. For .net 2.0 & above  you need to create a new browers file with the capabilities and upload it to your server.

  1. In VS2008 Solution Explorer right click your application and add the “ASP.Net Folder” App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser (if fixing the problem for Chrome)
  3. Delete all the default stuff VS put in this file and replace it with the following:
    <browsers> 
      <browser refID=”safari1plus”> 
        <controlAdapters> 
          <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” /> 
        </controlAdapters> 
      </browser> 
    </browsers>
  4. Save your file & test locally to see if all is well.
  5. Now for the annoying bit. Upload the new app_browser folder & file to your production server, if you have used the “copy web site” menu option to upload or sharepoint or frontpage, these will create a new folder under app_browsers called vti_cnf
  6. Manually delete the vti_cnf folder under app_browser on your production server. If you don’t you’ll get “Parse error: Data at the root level is invalid. Line 1, position 1.” in your new safari.browser file.
  7. Remember to manually delete this vti_cnf folder everytime you make a change to the app_browser folder or contained files.  

So there you go, how to solve the control rendering problems with Google’s Chrome.

If you found this information useful, send me an email and let me know or even better still visit my website and buy something it would be appreciated. I’ve got loads of software to send and receive SMS . And while you’re there try out the menu structure as it’s all working now.

Advertisements

26 Responses to Asp.Net Menu not rendering correctly in Google’s Chrome

  1. Amit says:

    Well, Google have bugs..
    Like any other software.

    Yet I find FF much more reliable for doing my developing.

  2. santosh says:

    amazing…
    thank you very much..
    working perfectly

  3. Xequence says:

    this works 100% with google chrome,safari, mozilla, and still errors out with IE 8. Unless you check the compatability fixer icon next to the reload button.

  4. Ivy says:

    i love u so much..
    thanks for solutions..it’s helping 😀

  5. Maya E.G says:

    fantastic!!!1

    Thank you so much….

    It’s working perfectly

  6. Shekhar says:

    Brilliant…
    that’s worked for me.
    Thanks a lot for the solution 🙂

  7. Thanks so much! So far so good…

  8. Andrew says:

    Worked brilliantly! I didn’t have the vti_cnf file problem.

    -Andrew

  9. Ashok says:

    Root level and first level menu (below root) started working fine but below those its still not working. Can anybody help?

  10. Naresh says:

    Hello friends i have same type of problem but little different. In my project the menu control is shown in all browsers but in chrome the item which have the children are stretched to the right side of the screen till the scroll bars.
    Plz plz somebody help me out.
    Thanks
    Naresh Kumar

  11. adarsh says:

    Thanks buddy…..

  12. Aida says:

    Thanks! This is so helpful.

  13. Mikhail says:

    Thanks so much 🙂
    it works!

  14. Hitesh Riziya says:

    Thanks.. !!

  15. anu says:

    Hi thanks its really working fine…..
    thanks a lot….

  16. MInal says:

    Great….
    Thanks a Lot….
    It works for me …

  17. Bhuvan says:

    Awesome awesome…thank a lot and keep it up

  18. Ravi says:

    Working Great Thanks !!! To The Point
    Thank You

  19. Karthik says:

    Superb.,

    It Worked Perfectly i liked it………

  20. Nisha says:

    hello sir, it gives error “The browser or gateway element with ID ‘safari1plus’ cannot be found.” I am using VB.net. Anything need to be changed as per that. Kindly advise.

  21. UKV says:

    I used the .browser file, But Mouse hover is not bringing the sub menu items in Chrome 😦

  22. veer says:

    Thanks a lot … solved a lots of problem…

  23. Harshad says:

    Yes! It Works Fine…
    Thanks…

  24. roulette says:

    Normally I do not learn article on blogs, but I wish to say that this write-up very
    pressured me to try and do it! Your writing taste has been surprised me.
    Thanks, very great article.

  25. google says:

    Wow, fantastic blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look of your website
    is wonderful, as well as the content!

  26. Zafeer says:

    Thanks a million ..Buddy….It works perfectly.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: