New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Templates

The RadSiteMap gives you full control over the node markup.

You can define per-level, per-node and global templates.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • Styles.css
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="SiteMap.Examples.Templates.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadSiteMapDataSource runat="server" ID="RadSiteMapDataSource1" ShowStartingNode="false"
        SiteMapFile="~/Examples.sitemap"></telerik:RadSiteMapDataSource>

    <div class="demo-container size-narrow no-bg">
        <telerik:RadSiteMap runat="server" ID="RadSiteMap1" Skin="Telerik" DataSourceID="RadSiteMapDataSource1"
            Width="350px" OnNodeDataBound="RadSiteMap1_NodeDataBound">
            <LevelSettings>
                <telerik:SiteMapLevelSetting Level="0" MaximumNodes="1">
                    <NodeTemplate>
                        <h3 class="Header">
                            <%# DataBinder.Eval(Container.DataItem, "title") %></h3>
                    </NodeTemplate>
                </telerik:SiteMapLevelSetting>
                <telerik:SiteMapLevelSetting Level="1" MaximumNodes="5">
                    <NodeTemplate>
                        <%--You can bind to an attribute of the data item
                        using the following syntax: Eval("[attribute key]")--%>
                        <div class="ContentHolder">
                            <%-- The href would normally be bound to <%# DataBinder.Eval(Container.DataItem, "url") %> --%>
                            <a href='#'>
                                <%# DataBinder.Eval(Container.DataItem, "title") %>
                            </a>
                        </div>
                    </NodeTemplate>
                </telerik:SiteMapLevelSetting>
                <telerik:SiteMapLevelSetting Level="2" Layout="Flow">
                </telerik:SiteMapLevelSetting>
            </LevelSettings>
        </telerik:RadSiteMap>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance