This is a migrated thread and some comments may be shown as answers.

Menu in MOSS

6 Answers 44 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 28 Nov 2008, 09:50 AM
Hi,

I'm trying to build a navigation control for Sharepoint using RadMenu. It almost works, in that the menu appears on screen, but the problem I'm having is that the submenus don't open.
I looked at the HTML source and the submenus have been rendered, but the menu control just won't display them when I rollover.

I've attached my code below. Any help would be much appreciated!

<%

@ Control Language="vb" AutoEventWireup="false" CodeBehind="MOSS_InternetTopMenu.ascx.vb" Inherits="MOSS_InternetSideMenu.MOSS_InternetTopMenu" %>

 

<%

@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

 

<

telerik:RadMenu ID="topMenu" Runat="server">

 

</

telerik:RadMenu>

 



Imports

Microsoft.SharePoint

 

Imports

Microsoft.SharePoint.WebControls

 

Imports

Microsoft.SharePoint.WebPartPages

 

Imports

Microsoft.SharePoint.Publishing.Navigation

 

Imports

PublishingWeb = Microsoft.SharePoint.Publishing.PublishingWeb

 

Imports

PublishingWebCollection = Microsoft.SharePoint.Publishing.PublishingWebCollection

 

Imports

SPWebTemplate = Microsoft.SharePoint.SPWebTemplate

 

Imports

Microsoft.SharePoint.Publishing

 

Imports

Telerik.Web.UI

 

Partial

Public Class MOSS_InternetTopMenu

 

 

Inherits System.Web.UI.UserControl

 

 


Private
currentSite As SPSite

 

 

Private currentWebRoot As SPWeb

 

 


Protected
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

    If Not IsPostBack Then

 

        currentSite = SPContext.Current.Site

        currentWebRoot = SPContext.Current.Site.RootWeb

 

        If HttpContext.Current.User.Identity.IsAuthenticated = False Then

 

            SPSecurity.RunWithElevatedPrivileges(

AddressOf Me.PopulateMenu)

 

 

        End If

 

 

    End If

 

 

End Sub

 

 


Private
Sub PopulateMenu()

 

 

    Try

 

 

        Dim elevatedSiteColl As SPSite

 

 

        Dim elevatedWebRoot As SPWeb

 

        elevatedSiteColl =

New SPSite(currentSite.ID)

 

        elevatedWebRoot = elevatedSiteColl.OpenWeb(currentWebRoot.ID)

 

        Dim rootWeb = PublishingWeb.GetPublishingWeb(elevatedWebRoot)

 

 

        Dim defaultPageUrl As String = rootWeb.DefaultPage.ServerRelativeUrl

 

 

        Dim smnHome As PortalListItemSiteMapNode = DirectCast(PortalSiteMapProvider.CombinedNavSiteMapProvider.FindSiteMapNode(defaultPageUrl), PortalListItemSiteMapNode)

 

 

        
        For
Each smnTopLevelItem As SiteMapNode In smnHome.ParentNode.ChildNodes

 

 

            Dim NewMenuItem As New RadMenuItem

 

            NewMenuItem.Text = smnTopLevelItem.Title

            NewMenuItem.NavigateUrl = smnTopLevelItem.Url

            topMenu.Items.Add(NewMenuItem)

 

            If smnTopLevelItem.HasChildNodes Then

 

 

                For Each smnChildItem As SiteMapNode In smnTopLevelItem.ChildNodes

 

 

                    Dim NewChildItem As New RadMenuItem

 

                    NewChildItem.Text = smnChildItem.Title

                    NewChildItem.NavigateUrl = smnChildItem.Url

                    NewMenuItem.Items.Add(NewChildItem)

 

                Next

 

 

            End If

 

 

        Next

 

 

    Catch ex As Exception

 

 

    End Try

 

 

End Sub

 

End

Class

 

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Nov 2008, 09:59 AM
Hi Developer,

The most common reason for this problem is JavaScript errors. This usually occurs when the web resource http handler is not properly configured. Please check this blog post for additional info on that matter.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark
Top achievements
Rank 1
answered on 28 Nov 2008, 10:05 AM
Thanks, I'll have a look.

My page isn't displaying any Javascript errors though, as far as I can tell the page is loading fine.
0
Mark
Top achievements
Rank 1
answered on 28 Nov 2008, 10:50 AM
Unfortunately, that hasn't helped. I ran Fiddler and all seemed fine. And, like I said, the page is showing no Javascript errors. Do you have any other ideas what it could be?

Many thanks!
0
Atanas Korchev
Telerik team
answered on 28 Nov 2008, 11:51 AM
Hello Developer,

Unfortunately I cannot think of any other things which could prevent RadMenu from expanding. Is there any live url where I can observe this behavior?

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark
Top achievements
Rank 1
answered on 28 Nov 2008, 12:00 PM
Unfortunately we don't have this on a live environment at the moment.

I make sure it wasn't me putting the menu together incorrectly, I hard coded a simple one (code shown below). This worked fine on my local PC, but when I tried to add it to a MOSS site I get the same results.

<%

@ Control Language="vb" AutoEventWireup="false" CodeBehind="TestTopMenu.ascx.vb" Inherits="MOSS_InternetSideMenu.TestTopMenu" %>

 

<%

@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

 

<

telerik:RadMenu ID="RadMenu1" Runat="server">

 

 

<Items>

 

 

<telerik:RadMenuItem Text="Menu 1">

 

 

<Items>

 

 

<telerik:RadMenuItem Text="Sub 1"></telerik:RadMenuItem>

 

 

<telerik:RadMenuItem Text="Sub 2"></telerik:RadMenuItem>

 

 

</Items>

 

 

</telerik:RadMenuItem>

 

 

<telerik:RadMenuItem Text="Menu 2">

 

 

<Items>

 

 

<telerik:RadMenuItem Text="Sub 3"></telerik:RadMenuItem>

 

 

<telerik:RadMenuItem Text="Sub 4"></telerik:RadMenuItem>

 

 

</Items>

 

 

</telerik:RadMenuItem>

 

 

</Items>

 

</

telerik:RadMenu>

 

0
Atanas Korchev
Telerik team
answered on 28 Nov 2008, 12:51 PM
Hi,

Unfortunately I cannot see why this problem is happening. Please check whether some CSS rule of your MOSS site is not preventing the menu from opening. Check for any rules containing "display:none !important" or something similar.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Menu
Asked by
Mark
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mark
Top achievements
Rank 1
Share this question
or