This is a migrated thread and some comments may be shown as answers.
I need less HTML and CSS in RadSiteMap
4 Answers 69 Views
This is a migrated thread and some comments may be shown as answers.
Arno
Top achievements
Rank 2
Arno asked on 28 Feb 2013, 05:02 PM
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!

4 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 01 Mar 2013, 01:31 PM
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.
0
Arno
Top achievements
Rank 2
answered on 01 Mar 2013, 02:20 PM
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?
0
Ivan Zhekov
Telerik team
answered on 08 Mar 2013, 06:53 PM
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.
0
Arno
Top achievements
Rank 2
answered on 09 Mar 2013, 11:36 AM
Thanks a lot Ivan!
Asked by
Arno
Top achievements
Rank 2
Answers by
Ivan Zhekov
Telerik team
Arno
Top achievements
Rank 2
Share this question
or