Internal Build: SiteMapPath and RadSiteMap not working?

Posted by Community Admin on 03-Aug-2018 16:21

Internal Build: SiteMapPath and RadSiteMap not working?

All Replies

Posted by Community Admin on 18-Mar-2011 00:00

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.

Posted by Community Admin on 22-Mar-2011 00:00

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>

2. Code behind

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;


Greetings,
Victor Velev
the Telerik team

Posted by Community Admin on 22-Mar-2011 00:00

Victor,

I copied your code into the control and still am getting nothing. The ItemCreated event doesn't seem to be being raised either.

Posted by Community Admin on 23-Mar-2011 00:00

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>

2. The code behid:

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 = ">";
               
                
            
        
  
        
    


All the best,
Victor Velev
the Telerik team

Posted by Community Admin on 30-Mar-2011 00:00

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>

  Any updates on that? 

Posted by Community Admin on 01-Apr-2011 00:00

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

Posted by Community Admin on 01-Apr-2011 00:00

Hi Ivan.

I already had some code in the NodeDataBound Event. And it's not being called! 

But why? :-)

Regards

Dave

Posted by Community Admin on 06-Apr-2011 00:00

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


Posted by Community Admin on 21-Apr-2011 00:00

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?

Posted by Community Admin on 21-Apr-2011 00:00

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


Posted by Community Admin on 22-Jun-2011 00:00

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.....

or with any other control for that matter that you trying to reference through a custom user control change:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Yourcontrol.ascx.cs"

to

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Yourcontrol.ascx.cs"

I'd forgotten about this little gem. VS doesnt like it and will complain but the control works fine, so for simplicity's sake, leave it as CodeBehind while building and then change it to CodeFile.

eeeesh.

This thread is closed