Internal Build: SiteMapPath and RadSiteMap not working?
Basically what the title says. Anyone else experiencing this on Tuesday's internal build? My breadcrumb nav just disappeared. I tried to replace it with a RadSiteMap and it's empty too.
Hello Zak,
As my collegue Ivan wrote in the other forum thread about the breadcrumbs, try using the following code workaround to fix the issue:
1. Template
<asp:SiteMapPath ID="SiteMapPath1" runat="server" RenderCurrentNodeAsLink="true" ><CurrentNodeTemplate><asp:HyperLink runat="server" ID="CurrentNodeLink"></asp:HyperLink></CurrentNodeTemplate></asp:SiteMapPath>protected void Page_Load(object sender, EventArgs e)this.SiteMapPath1.ItemCreated += new SiteMapNodeItemEventHandler(SiteMapPath1_ItemCreated);void SiteMapPath1_ItemCreated(object sender, SiteMapNodeItemEventArgs e)if (e.Item.ItemType == SiteMapNodeItemType.Current)var currentNode = GetCurrentPageNode();var link = e.Item.FindControl("CurrentNodeLink") as HyperLink;link.Text = currentNode.UrlName;link.NavigateUrl = currentNode.UrlName;public static PageSiteNode GetCurrentPageNode()PageSiteNode result = null;result = SiteMapBase.GetCurrentProvider().CurrentNode as PageSiteNode;if (result != null)result = SiteMapBase.GetFirstPageDataNode(result);return result;Victor,
I copied your code into the control and still am getting nothing. The ItemCreated event doesn't seem to be being raised either.
Hello Zak,
SiteMapPath appears not to function as it should in the latest internal build. I have logged it in TFS ( BUG ID = 111307 ).
You will have to create a custom control for your breadcrumbs. Here is a quick workaround which you can modfiy so it suits your needs:
1. Template:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Bread.ascx.cs" Inherits="SitefinityWebApp.Templates.WebUserControl1" %> <asp:Repeater runat="server" ID="rep1"> <ItemTemplate> <asp:HyperLink runat="server" ID="nodelink1" /> <asp:Literal runat="server" ID="literalsep"></asp:Literal> </ItemTemplate> </asp:Repeater> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Sitefinity.Web; namespace SitefinityWebApp.Templates public partial class WebUserControl1 : System.Web.UI.UserControl protected override void OnInit(EventArgs e) protected void Page_Load(object sender, EventArgs e) var currentNode = SiteMapBase.GetActualCurrentNode(); List<PageSiteNode> list = new List<PageSiteNode>(); list.Add(currentNode); while (currentNode.ParentNode != null && currentNode.ParentNode.Title != "Pages") currentNode = currentNode.ParentNode as PageSiteNode; list.Add(currentNode); rep1.DataSource = list; rep1.ItemDataBound += new RepeaterItemEventHandler(rep1_ItemDataBound); rep1.DataBind(); void rep1_ItemDataBound(object sender, RepeaterItemEventArgs e) if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) var link = e.Item.FindControl("nodelink1") as HyperLink; var l = e.Item.FindControl("literalsep") as Literal; var node = e.Item.DataItem as PageSiteNode; link.Text = node.Url; link.NavigateUrl = node.Url; if (l != null) l.Text = ">"; Since i had some Index issues i updated to the newest internal build too. Now my custom navigation control doesn't get any data. I suppose this is the same bug:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="true" StartingNodeOffset="1" /><asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" PathSeparator="/" ShowExpandCollapse="False" PopulateNodesFromClient="false" OnDataBound="TreeView1DataBound" OnTreeNodeDataBound="TreeView1TreeNodeDataBound"></asp:TreeView>Hello,
If you subscribe for the events from the template, there should not be a problem. This works for SiteMapPath control. Can you put a breakpoint inside TreeView1TreeNodeDataBound and see if it is called?
Greetings,
Ivan Dimitrov
the Telerik team
Hi Ivan.
I already had some code in the NodeDataBound Event. And it's not being called!
But why? :-)
Regards
Dave
Hi,
I added the following code in a user control
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="true" />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" PathSeparator="/"
ShowExpandCollapse="False" PopulateNodesFromClient="false"
OnTreeNodeDataBound="TreeView1TreeNodeDataBound">
</asp:TreeView>
and the TreeView1TreeNodeDataBound is called. I tested with the latest internal build of Sitefinity 4.0.
Kind regards,
Ivan Dimitrov
the Telerik team
This hit me also. I submitted a support request to see if support can help me with a work around or something. Is this problem in PITS so that I can vote for it?
Hello Abraham,
I have logged it in PITS so you can vote for it and check its status at anytime.
Greetings,
Victor Velev
the Telerik team
FWIW... if like me you've been banging your head against a wall with constant
error CS0103: The name 'rep1' does not exist in the current.....<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Yourcontrol.ascx.cs"<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Yourcontrol.ascx.cs"