Thursday, February 18, 2010

ASP.net menu control does not render properly in Chrome and Safari

This was one major problem in the ASP.net website that I was working on. The control rendered properly in IE, Firefox and Opera EXCEPT Chrome and Safari. The initial guess was that there is something going wrong with my doctype settings and the CSS styles being applied.

A quick search over the net revealed that changing the Page.ClientTarget to "uplevel" will solve the issue; and it worked for few. But this didn't work for me.

Then there was a solution changing the web.config for adding browserCaps in the system.web section, which also failed for me.

Then, at last, there was solution adding .browser file to App_Browsers folder which worked for me.

Here are the steps.
1. Right click your project folder to add an ASP.net folder "App_Browsers".
2. Click "Add New" and create a browser file named Chrome.browser
3. Put the following code in that file after commenting the existing code.

<browsers>
<browser refID="safari1plus">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
</controlAdapters>
</browser>
</browsers>

References:
http://www.google.com/support/forum/p/Chrome/thread?tid=7506cca26ec06af7&amp;hl=en
http://forums.asp.net/p/1369765/2860698.aspx#2860698
http://browsercompatibility.codeplex.com/

No comments:

Post a Comment