.NET Menu website not displayed properly on Macintosh computers

I used the .NET menuitem command to create a menu for my website. I had expected .NET menuitem (a built in .NET tool) would display the menu correctly in the Safari browser, but it does not. I have attached a picture of the menu as it appears in the MAC and on the PC. I have also attached a code snippet.

Am I doing something wrong here, or is .NET menuitem really not completely compatible with Safari ? Help !

Thanks, Pete
<%@ Control Language="VB" ClassName="TopMenu" %>
<%@ Import Namespace="System.Data.SqlClient" %>
 
<script runat="server">
 
    Dim sqlstring, sqlstring1, NID, PID, EC, URL, EC1, URL1 As String
    Dim mwidth As Integer
    Dim MyConn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
    Dim MyConn1 As New SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
    Dim MyTools As New Krylium.KryliumTools
 
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
 
 If not page.IsPostBack then
 
       ' Load top menu
        
        Dim cMenuItm As MenuItem
        Dim menuItm As MenuItem
 
        
        With Menu1
 
            'Menu Configuration
            .Orientation = Orientation.Horizontal
            .DisappearAfter = 1000
            .MaximumDynamicDisplayLevels = 10
            .StaticDisplayLevels = 1
 
            'Menu Color Scheme
                
                .StaticMenuItemStyle.CssClass = "MenuItem"
                .StaticHoverStyle.CssClass = "MenuItemOver"
                .DynamicMenuItemStyle.CssClass = "SubmenuItem"
                .DynamicHoverStyle.CssClass = "SubmenuItemOver"
 
                .StaticMenuItemStyle.HorizontalPadding = 5
                .StaticMenuItemStyle.Width = 120
                .StaticMenuItemStyle.Height = 30
                .StaticEnableDefaultPopOutImage = False
            
            'Menu Dynamic Events
            
                .DynamicMenuItemStyle.Width = 120
                .DynamicMenuItemStyle.HorizontalPadding = 5
                .DynamicMenuItemStyle.Height = 20
            
        End With
        
        If MyTools.GetLanguage = "english" Then
            sqlstring = "Select M.ID, M.EnglishCaption, M.width from menuitem M, roles U WHERE (M.ParentItemID = 'Menuroot') and (U.ChannelID = '" & Session("Leaguenum") & "') and (U.RoleID = '" & Session("Rolenum") & "') and (CHARINDEX(M.PermissionID, U.PermissionIDs) > 0) ORDER BY M.SortOrder"
        Else
            sqlstring = "Select M.ID, M.FrenchCaption, M.width from menuitem m, roles U WHERE (M.ParentItemID = 'Menuroot') and (U.ChannelID = '" & Session("Leaguenum") & "') and (U.RoleID = '" & Session("Rolenum") & "') and (CHARINDEX(M.PermissionID, U.PermissionIDs) > 0) ORDER BY M.SortOrder"
        End If
 
        Dim cmd As New SqlCommand(sqlstring, MyConn)
 
        MyConn.Open()
        Dim MyReader As SqlDataReader = cmd.ExecuteReader()
 
        While MyReader.Read()
            NID = MyReader.GetString(0)
            EC = MyReader.GetString(1)
            mwidth = MyReader.GetInt16(2)
        
            'Create new root Item
            menuItm = New MenuItem
            menuItm.Text = EC
            menuItm.Selectable = False
            Menu1.Items.Add(menuItm)
            
            If MyTools.GetLanguage = "english" Then
                sqlstring1 = "Select M.EnglishCaption, M.URL from menuitem M, roles U WHERE (M.ParentItemID = '" & NID & "') and (U.ChannelID = '" & Session("Leaguenum") & "') and (U.RoleID = '" & Session("Rolenum") & "') and (CHARINDEX(M.PermissionID, U.PermissionIDS) > 0) ORDER BY M.ParentItemID, M.SortOrder"
            Else
                sqlstring1 = "Select M.FrenchCaption, M.URL from menuitem M, roles U WHERE (M.ParentItemID = '" & NID & "') and (U.ChannelID = '" & Session("Leaguenum") & "') and (U.RoleID = '" & Session("Rolenum") & "') and (CHARINDEX(M.PermissionID, U.PermissionIDs) > 0) ORDER BY M.ParentItemID, M.SortOrder"
            End If
 
            Dim cmd1 As New SqlCommand(sqlstring1, MyConn1)
 
            MyConn1.Open()
            Dim MyReader1 As SqlDataReader = cmd1.ExecuteReader()
 
            While MyReader1.Read()
                EC1 = MyReader1.GetString(0)
                URL1 = MyReader1.GetString(1)
        
                'Add Child Items
                cMenuItm = New MenuItem
                If EC1 = "separator" Then
                        cMenuItm.ImageUrl = "~/images/childmenuseparator.jpg"
                        cMenuItm.Selectable = False
                    Else
                        cMenuItm.Text = EC1
                        cMenuItm.NavigateUrl = URL1
                        '   cMenuItm.Target = "_blank"
                End If
                menuItm.ChildItems.Add(cMenuItm)
                
            End While
 
            MyReader1.Close()
            MyConn1.Close()
        
        End While
 
        MyReader.Close()
        MyConn.Close()
        
        end if
 
    End Sub
 
 
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>
<asp:Menu ID="Menu1" runat="server" />
</body></html>

Open in new window

PC-menu.JPG
mac-menu.jpg
pbisseggerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
pbisseggerConnect With a Mentor Author Commented:
OK,

I have found the solution to the problem. Funny, I had searched using Google on my PC for hours and could not get a solution, and the first search I did with Google on my Mac brought me to the solution.

The issue is not that ASP.NET cannot support interoperability, it is that that Microsoft does not do their due diligence to keep the list of interoperable browsers (and their capabilities) up to date. There is a file (Browser caps) that Microsoft is supposed to be populating and registering the browser versions with their capabilities. The way Microsoft has designed it, if they do not register a new browser in their capabilities matrix, ASP.NET 2.0 assumes it has very little capability and does not render advanced functions (like menus) at all.

In order to solve the problem, I needed to create a file in the App_Browsers folder (which I called safari.browser) which contained the following code:

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

It works great !

I found the solution in a post at forums.asp.net/t/941229.aspx
0
 
Mortaza DoulatyCommented:
It is not too odd!
Microsoft based technologies...
Do not expect too much!

An alternative way is to use third-party menu components.
Like Telerik, SoThink DHTML Menu or ...
They work well of four major browsers (IE, FireFox, Safari, Opera)
0
 
rhythmluvrCommented:
I program for IE, Firefox & Safari, if you program for all three you going to have to compromise in some areas. This control is probably just one of a dozen that will not work in Safari. I use to only program for IE and Firefox until I went Mac this past year, some of the applications I have written do not render properly in Safari. I truly believe that Safari is the best browser made, fast with many features. I wouldn't blame Apple on this one.
0
 
Mortaza DoulatyCommented:
Nice and easy!
0
 
Vee_ModCommented:
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0
All Courses

From novice to tech pro — start learning today.