separator template with List

5 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    436 posts
    Member since:
    Feb 2007

    Posted 12 Jun Link to this post

    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

  2. Eric R | Technical Support Engineer
    Admin
    Eric R | Technical Support Engineer avatar
    138 posts

    Posted 14 Jun Link to this post

    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.
  3. Fit2Page
    Fit2Page avatar
    436 posts
    Member since:
    Feb 2007

    Posted 17 Jun in reply to Eric R | Technical Support Engineer Link to this post

    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

  4. Eric R | Technical Support Engineer
    Admin
    Eric R | Technical Support Engineer avatar
    138 posts

    Posted 18 Jun Link to this post

    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.
  5. Fit2Page
    Fit2Page avatar
    436 posts
    Member since:
    Feb 2007

    Posted 19 Jun in reply to Eric R | Technical Support Engineer Link to this post

    Thanks Eric, this solution works as expected.

     

    Marc

Back to Top