This is a migrated thread and some comments may be shown as answers.

separator template with List

4 Answers 87 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 12 Jun 2019, 01:59 PM

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

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 14 Jun 2019, 04:58 PM
Hi Marc,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 17 Jun 2019, 09:21 AM

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

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 18 Jun 2019, 05:14 PM
Hi 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.rsmLevel1 > 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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Jun 2019, 08:12 AM

Thanks Eric, this solution works as expected.

 

Marc

Tags
SiteMap
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or