This is a migrated thread and some comments may be shown as answers.
RadSiteMap NodeTemplate Issue
5 Answers 91 Views
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 2
Jacques asked on 29 Mar 2012, 11:02 AM
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

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 30 Mar 2012, 09:52 AM
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.
0
Jacques
Top achievements
Rank 2
answered on 02 Apr 2012, 08:40 AM
Hi Peter,

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

Regards,
Jacques
0
Peter
Telerik team
answered on 03 Apr 2012, 08:59 AM
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.
0
Mayur
Top achievements
Rank 1
answered on 04 Sep 2012, 06:13 AM
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
0
Kate
Telerik team
answered on 05 Sep 2012, 03:27 PM
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.
Asked by
Jacques
Top achievements
Rank 2
Answers by
Peter
Telerik team
Jacques
Top achievements
Rank 2
Mayur
Top achievements
Rank 1
Kate
Telerik team
Share this question
or