RadSiteMap NodeTemplate Issue

6 posts, 0 answers
  1. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 29 Mar 2012 Link to this post

    The documentation seems to point out that you can use NodeTemplates when using a DataSource, but if I have a SiteMap declaritvely populated how can define a Node template and use the Text value of the Node in the template?

    Code sample (see the bold black text - this is where the telerik documentation would use the databinder to bind to a datasource, but I just want to be able to determine how the node with the text value is represented. I could just type it in I guess? ):
    <telerik:RadSiteMap ID="SiteMap" CssClass="subNavSiteMap" runat="server" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedSkins="False">
        <LevelSettings>
            <telerik:SiteMapLevelSetting Level="0" ListLayout-RepeatColumns="3" ListLayout-RepeatDirection="Horizontal">
            </telerik:SiteMapLevelSetting>
        </LevelSettings>
        <Nodes>
            <telerik:RadSiteMapNode Text="Menu 1" runat="server">
                <NodeTemplate>
                    <h3 class="Header">
                        [show the text from the SiteMapeNode: Menu 1]</h3>
                </NodeTemplate>
                <Nodes>
                    <telerik:RadSiteMapNode Text="SubMenu 1" NavigateUrl="" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 2" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 3" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 4" runat="server">
                    </telerik:RadSiteMapNode>
                </Nodes>
            </telerik:RadSiteMapNode>
            <telerik:RadSiteMapNode Text="Menu 2" runat="server">
                <Nodes>
                    <telerik:RadSiteMapNode Text="SubMenu 1" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 2" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 3" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 4" runat="server">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode Text="SubMenu 5" runat="server">
                    </telerik:RadSiteMapNode>
                </Nodes>
            </telerik:RadSiteMapNode>
        </Nodes>
    </telerik:RadSiteMap>

    Regards,
    Jacques
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 30 Mar 2012 Link to this post

    Hello Jacques,

    Here is one possible solution:
    <telerik:RadSiteMapNode Text="Menu 1" runat="server">
                   <NodeTemplate>
                       <h3 class="Header">
                           <asp:Literal ID="Literal1" runat="server"></asp:Literal>
                         </h3>
                   </NodeTemplate>

    protected void Page_Load(object sender, EventArgs e)
       {      
           foreach (RadSiteMapNode node in SiteMap1.GetAllNodes())
           {
               Literal nodeText = node.FindControl("Literal1") as Literal;
               if (nodeText != null)
               {
                   nodeText.Text = node.Text;
               }
           }
       }

    Let me know if you have any other questions.

    Regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 02 Apr 2012 Link to this post

    Hi Peter,

    I just went the declarative root all the way using templates for each node.

    Regards,
    Jacques
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Apr 2012 Link to this post

    Hi Jacques,

    Thank you for getting back to me. I hope you have managed to implement your requirement fully. In case you have any questions, drop us a line.

    Regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Mayur
    Mayur avatar
    4 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    Hi,
    I used a rad site map for my application. I used rad site map item builder to make all the nodes and specifying there navigation url's. If i do not change any settings then it displays as a list, displaying all the nodes. if i change the  layout setting to flow then it shows only the main node. if i navigate to a different page then also main node is shown unlike asp site map which shows main node and then the subsequent nodes . I want the the layout to be flow and i do not want to bind it to a data source.

    any suggestions ?

    thanks in advance
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 05 Sep 2012 Link to this post

    Hi Manoj,

    I am not quite sure that i understand the issue that you get. Can you please elaborate more on your scenario, any images that demonstrates the correct look that you are trying to achieve as well as the one that you currently get would be very helpful? Can you also provide some code that I can inspect locally and help you out? 

    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017