+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Displaying Sibling links if no Children present

Displaying Sibling links if no Children present

1 posts, 0 answered
  1. Arun
    Arun avatar
    10 posts
    Registered:
    03 Nov 2011
    25 Sep 2014
    Link to this post

    Hi,

    I am trying to edit the Navigation template to show the sibling links when no child nodes are present.i have  tried the below code but getting error- Cannot
    convert type 'System.Web.SiteMapNodeCollection' to
    'Telerik.Sitefinity.Web.UI.NavigationControls.SitefinitySiteMapDataSource'

     Please help me know the alternative solution to bind child nodes in navigation container, if child nodes are not present then  should bind the siblings

    <navigation:NavigationContainer runat="server" DataSourceID="dataSource">
        <Templates>
            <navigation:NavigationTemplate runat="server">

                <Template>
                    <li>
                      <navigation:NavigationContainer ID="NavigationContainer1" runat="server" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>'>
                            <Templates>
                                <navigation:NavigationTemplate ID="NavigationTemplate1" runat="server">

                                    <Template>
                                        <li>
                                            <a id="A1" runat="server" href='<%# NavigationUtilities.ResolveUrl(Container.DataItem) %>' target='<%# NavigationUtilities.GetLinkTarget(Container.DataItem) %>'><%# Eval("PageTitle") %></a>
                                        </li>
                                    </Template>
                                    <SelectedTemplate>
                                        <li class="active">
                                            <a id="A2" runat="server" href='<%# NavigationUtilities.ResolveUrl(Container.DataItem) %>' class="active" target='<%# NavigationUtilities.GetLinkTarget(Container.DataItem) %>'><%# Eval("PageTitle") %></a>
                                        </li>
                                    </SelectedTemplate>
                                </navigation:NavigationTemplate>
                            </Templates>

                        </navigation:NavigationContainer>
                    </li>
                </Template>
                <SelectedTemplate>

                </SelectedTemplate>
            </navigation:NavigationTemplate>
        </Templates>

    </navigation:NavigationContainer>

     

    Thanks,

    Arun

1 posts, 0 answered