Hi,
Why is the following only working with Flow and not with List:
<telerik:SiteMapLevelSetting Level="1" ListLayout-RepeatDirection="Vertical" Layout="List">
<NodeTemplate>
<asp:HyperLink ID="HyperLink1" CssClass="rsmlink" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "linkto") %>' Text='<%# DataBinder.Eval(Container.DataItem, "description") %>' runat="server"></asp:HyperLink>
</NodeTemplate>
<SeparatorTemplate><hr /></SeparatorTemplate>
</telerik:SiteMapLevelSetting>
I need to create separators between the items...
Marc
4 Answers, 1 is accepted
Each SiteMap Layout has different properties available. The SeparatorList is only available on the Flow Layout which is why the the code snippet only works with it. The differences between List and Flow can be seen at the RadSiteMap Overview demo.
To create separators for each item, you can add the Horizontal Rule below the HyperLink control to the NodeTemplate. See the markup below that achieves this.
<
telerik:RadSiteMap
ID
=
"RadSiteMap1"
runat
=
"server"
DataSourceID
=
"RadSiteMapDataSource1"
>
<
LevelSettings
>
<
telerik:SiteMapLevelSetting
Level
=
"1"
ListLayout-RepeatDirection
=
"Vertical"
Layout
=
"List"
>
<
NodeTemplate
>
<
asp:HyperLink
ID
=
"HyperLink1"
CssClass
=
"rsmlink"
NavigateUrl
=
"#"
Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>' runat="server"></
asp:HyperLink
>
<
hr
/>
</
NodeTemplate
>
</
telerik:SiteMapLevelSetting
>
</
LevelSettings
>
</
telerik:RadSiteMap
>
Please let me know if you have any additional questions. Thank you for choosing Telerik.
Regards,
Eric R
Progress Telerik

Thanks Eric.
The problem with this setup is of course that the separator hr is also shown for the last items in a node.
marc
That is correct. The original sample I provided will generate a Horizontal Rule after each item in the template. Changing templates through the code-behind or in the markup isn't officially supported. As a workaround, some CSS magic should do the trick.
Below is an example I tested to hide the Horizontal Rule for the last item in each list. Note that depending on the depth of the SiteMap this might need some tweaking.
ul.rsmList.rsmLevel
1
> li.rsmItem:last-of-type .rsmTemplate > hr {
visibility
:
hidden
;
}
Please give this a try and let me know if you have any additional questions. Thank you.
Regards,
Eric R
Progress Telerik

Thanks Eric, this solution works as expected.
Marc