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

Panels not opening

2 Answers 43 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 03 Sep 2008, 01:12 PM
Hi,

Having a curious problem with the PanelBar that I've never had before. The only difference this time is that I'm trying to use it in a Sharepoint environment. I should point out here that I've also got a Telerik radMenu control on the same page and that works fine.

The code for the menu is as follows:

ASCX:

<

telerik:RadPanelBar ID="radMenu" Runat="server">

</

telerik:RadPanelBar>

ASCX.VB

Imports

System
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.IO
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_InternetSideMenu

Inherits System.Web.UI.UserControl

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

Try
Dim rootWeb As PublishingWeb = PublishingWeb.GetPublishingWeb(SPContext.Current.Site.RootWeb)
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 rpi As New RadPanelItem
  CreateParentMenuItem(rpi, smnTopLevelItem.Title.ToString,
"", smnTopLevelItem.Url.ToString)

  radMenu.Items.Add(rpi)

  If smnTopLevelItem.HasChildNodes Then
    
For Each smnChildItem As SiteMapNode In smnTopLevelItem.ChildNodes
      
Dim rpiChild As New RadPanelItem
       CreateSubMenuItem(rpiChild, smnChildItem.Title.ToString,
"", rpi, smnChildItem.Url.ToString)
    
Next
 
End If
Next

Catch ex As Exception
 Response.Write(ex.ToString)
End Try

End Sub

 

Sub CreateParentMenuItem(ByVal rpi As RadPanelItem, ByVal strItemText As String, ByVal strCssClass As String, ByVal strURL As String)

'adds main menu item

 rpi.Items.Clear()
 rpi.Text = strItemText
 rpi.CssClass = strCssClass
 rpi.PostBack =

False
End Sub

Sub CreateSubMenuItem(ByVal rpi As RadPanelItem, ByVal strItemText As String, ByVal strCssClass As String, ByVal rpiParent As RadPanelItem, ByVal strURL As String)

'adds sub menu item

rpi.Items.Clear()
rpi.Text = strItemText
rpi.CssClass = strCssClass
rpi.NavigateUrl = strURL
rpiParent.Items.Add(rpi)

End Sub


The menu displays fine, it just doesn't open. To make sure it wasn't a a coding error, I tried it with a static menu that I know works and got the same result.

Any help would be much appreciated.

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 03 Sep 2008, 01:42 PM
Hello Developer,

Panels may not open if there is a javascript error or the panel item does not have any child items.

Greetings,
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 03 Sep 2008, 03:21 PM
Thatnks for that, there was indeed a Javascript error on the page that I didn't notice. I tried it on a fresh page and it worked fine.
Tags
PanelBar
Asked by
Mark
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mark
Top achievements
Rank 1
Share this question
or