I need less HTML and CSS in RadSiteMap

5 posts, 0 answers
  1. Arno
    Arno avatar
    19 posts
    Member since:
    Sep 2010

    Posted 28 Feb 2013 Link to this post

    Hello everyone,

    I have a similar issue as described here. I'm using the RadSiteMap within the template of the breadcrumb widget in Sitefinity 5.4. It's rendering too many tags and css classes.

    This is my template:
    <div itemprop="breadcrumb" class="rBread">
        <telerik:RadSiteMap runat="server" ID="Breadcrumb" EnableEmbeddedBaseStylesheet="false" EnableEmbeddedSkins="false" ClientIDMode="Static" OnNodeDataBound="RadSiteMap_NodeDataBound" OnDataBound="RadSiteMap_OnDataBound">
            <DefaultLevelSettings Layout="Flow">
                <NodeTemplate>
                    <asp:HyperLink ID="L" runat="server"></asp:HyperLink><asp:Literal ID="Txt" runat="server"></asp:Literal>
                </NodeTemplate>
                <SeparatorTemplate>
                    <div></div>
                </SeparatorTemplate>
            </DefaultLevelSettings>
        </telerik:RadSiteMap>
    </div>

    This is what is being rendered:
    <div itemprop="breadcrumb" class="rBread">
        <div id="Breadcrumb" class="RadSiteMap RadSiteMap_Default">
            <!-- 2012.3.1308.40 --><ul class="rsmFlow rsmLevel rsmOneLevel">
                <li class="rsmItem sfBreadcrumbNavigation"><div class="rsmTemplate">
                     
                    <a id="L" href="/">Home</a>
                 
                </div>
                    <div></div>
                </li> <li class="rsmItem sfBreadcrumbNavigation"><div class="rsmTemplate">
                     
                    <a id="L" href="/contact">Get in touch</a>
                 
                </div>
                    <div></div>
                </li> <li class="rsmItem sfNoBreadcrumbNavigation"><div class="rsmTemplate">
                     
                    Forum
                 
                </div></li>
            </ul><input id="Breadcrumb_ClientState" name="Breadcrumb_ClientState" type="hidden" />
        </div>
    </div>

    This is what I need to be rendered:
    <div itemprop="breadcrumb" class="rBread">
                    <a id="L" href="/">Home</a>
                    <div></div>
                    <a id="L" href="/contact">Get in touch</a>
                    <div></div>
                    Forum
    </div>

    How can I achieve that, or at the very least remove all the class attributes I don't need?

    Thank you!
  2. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    539 posts

    Posted 01 Mar 2013 Link to this post

    Hi, Arno.

    You can not easily override the settings of Sitemap, at least not in a way that's useful to you.

    The extra DIV elements that are rendered, the one with class name rmsTemplates are there because you are using templates.

    Since what you really want to do is list simple links ( I see that you have turned off both embedded skins and base skins), is to use a repeater.

    The repeater will render no more nor less html from the one you specify. Repeaters also have separator templates, so you can achieve that too.

    I suppose this is not exactly the answer you are looking for, but I really think a repeater will suit you better in this particular case.

    Regards,
    Ivan Zhekov
    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. Arno
    Arno avatar
    19 posts
    Member since:
    Sep 2010

    Posted 01 Mar 2013 Link to this post

    Hi Ivan,

    That's a good suggestion I guess. I'm not sure if it's a lot of work though. Could you provide a little more detail on how to accomplish this? Would I create a custom control that inherits from RadSiteMap (or the Sitefinity Breadcrumb widget?), add a repeater to the template and set its datasource to the datasource of the RadSiteMap?
  5. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    539 posts

    Posted 08 Mar 2013 Link to this post

    Hello, Arno.

    I have attached a proof of concept. The actual implementation will vary depending on your data source.

    Regards,
    Ivan Zhekov
    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. Arno
    Arno avatar
    19 posts
    Member since:
    Sep 2010

    Posted 09 Mar 2013 Link to this post

    Thanks a lot Ivan!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017