tags:

views:

763

answers:

5

On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?

+1  A: 

You can use ControlAdapters to alter the rendering of server controls.

Here's an example: http://www.pluralsight.com/community/blogs/fritz/archive/2007/03/27/46598.aspx

Though, in my opinion it might be equal amount of work to abandon the menu control for a pure css one (available on many sites).

Ben Scheirman
http://www.big-o.org/?p=20 is a good resource as well
Swati
A: 

Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...

deepcode.co.uk
+1  A: 

Thanks for the advice, it led me into the following solution;

I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;

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

As I understand it, this tells ASP.NET not to use the adaptor it would normally use to render the control content and instead use uplevel rendering.

deepcode.co.uk
A: 

The best and simplest solution I've found for this problem is to include this bit of code in your page_load event.

if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
    Request.Browser.Adapters.Clear();
jonezy
+1  A: 

Wow! thank you, deepcode.co.uk, it's work!