Hi, I am using the Q1 2009 release of your amazing controls. I am using the Panel Bar with a sitemap data source (MOSS2007). This leads to me no being able to expand the panels as the top level items have a url set. I have followed the KB article 'Preserve the expand and collapse functionality of an item which has its NavigateUrl property set.' There are a number of thins that don't add up when comparing the example against the Q1 2009 control.
- There is no image element to be found in the DOM of the panelbar the expand arrows are just the backgund image of the SPAN tag. This means that the java script function to trap the click fails everytime as there is no ImageElement
- The 'panelbar.AllItems.length' fails on each call as 'AllItems' is undefined.
- Using the code behind method to add Image and Expanded Image urls doesn't seem to work for me, the only way I could get them to show up was to modify the css as follows :
/* <expand arrows> */ | |
/* | |
.RadPanelBar_ECPanelBar .rpExpandable .rpText, | |
.RadPanelBar_ECPanelBar .rpExpanded .rpText | |
{ | |
background-color: transparent; | |
background-image: url('PanelBar/Expandable.png'); | |
} | |
*/ | |
.RadPanelBar_ECPanelBar .rpExpandable .rpText, | |
{ | |
background-color: transparent; | |
background-image: url('PanelBar/arrow-down.png'); | |
} | |
.RadPanelBar_ECPanelBar .rpExpanded .rpText | |
{ | |
background-color: transparent; | |
background-image: url('PanelBar/arrow-up.png'); | |
background-position: 100% 0px !important; | |
} | |
/* </expand arrows> */ | |
The 0px is due to the standard value being -467px and hiding the image.
Please see the markup of the composite control I am making (due to code behind restictions in MOSS this is a much easier way)
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LeftNav.ascx.cs" Inherits="usercontrols_LeftNav" compilationMode="Always" %> | |
<%@ Register assembly="Telerik.Web.UI, Version=2009.1.311.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" | |
namespace="Telerik.Web.UI" tagprefix="telerik" %> | |
<script type="text/javascript"> | |
function onClicking(sender, eventArgs) | |
{ | |
var target = eventArgs.get_domEvent().target; | |
var item = eventArgs.get_item(); | |
if (target == eventArgs.get_item().get_imageElement()) | |
{ | |
if (item.get_expanded()) | |
item.collapse(); | |
else | |
item.expand(); | |
eventArgs.set_cancel(true); | |
} | |
} | |
</script> | |
<telerik:RadAjaxManagerProxy runat="server" ID="rampChild" > | |
</telerik:RadAjaxManagerProxy> | |
<telerik:RadPanelBar runat="server" ID="rpbVertNav" PersistStateInCookie="true" | |
Skin="ECPanelBar" | |
ExpandMode="SingleExpandedItem" EnableEmbeddedSkins="false" | |
OnClientItemClicking="onClicking" onitemdatabound="rpbVertNav_ItemDataBound"> | |
</telerik:RadPanelBar> |
using System; | |
using System.Web; | |
using Telerik.Web.UI; | |
public partial class usercontrols_LeftNav : System.Web.UI.UserControl | |
{ | |
private string _siteMapID = "QuickLaunchSiteMap"; | |
public string siteMapID { get { return this._siteMapID; } set { this._siteMapID = value; } } | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
protected override void OnInit(EventArgs e) | |
{ | |
base.OnInit(e); | |
rpbVertNav.DataSourceID = _siteMapID; | |
} | |
protected void rpbVertNav_ItemDataBound(object sender, RadPanelBarEventArgs e) | |
{ | |
if (e.Item.Items.Count > 0) | |
{ | |
e.Item.ImageUrl = "arrow-down.png"; | |
e.Item.ExpandedImageUrl = "arrow-up.png"; | |
e.Item.ImagePosition = RadPanelItemImagePosition.Right; | |
} | |
} | |
} |
This is the js I was trying to use as taken from your sample
<script type="text/javascript"> | |
<!-- For radPanelBar --> | |
function OnLoad(sender, args) | |
{ | |
var panelbar = sender; | |
for (var i = 0; i < panelbar.AllItems.length; i++) | |
{ | |
var panelItem = panelbar.AllItems[i]; | |
if (panelItem.ImageElement) | |
{ | |
panelItem.ImageElement.AssociatedItem = panelItem; | |
panelItem.ImageElement.onclick = function (e) | |
{ | |
if (!e) e = window.event; | |
if (this.AssociatedItem.Expanded) | |
{ | |
this.AssociatedItem.Collapse(); | |
} | |
else | |
{ | |
this.AssociatedItem.Expand(); | |
} | |
e.cancelBubble = true; | |
if (e.stopPropagation) | |
{ | |
e.stopPropagation(); | |
} | |
return false; | |
} | |
} | |
} | |
} | |
</script> |
I really want to use this panel bar control for my navigation in this site but i cannot as it will not expand as expected. PLease can you update the sample to work with Q1 2009 or post a 2009 working sample using a sitemapdatasource.
Many Thanks
Chris