SiteMap - Server-side Events

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadSiteMap introduces two server-side events for working with nodes:

  • NodeCreated occurs when a new node is added to the control (at any level)
  • NodeDataBound occurs when a node is bound to a data source

This example shows how to use the NodeDataBound event to filter certain nodes. The nodes are then processed in the DataBound event and the total children count for each node is displayed.

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

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</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">
        <telerik:RadSiteMap runat="server" ID="SiteMap1" DataSourceID="RadSiteMapDataSource1"
            OnNodeDataBound="SiteMap1_NodeDataBound" OnDataBound="SiteMap1_DataBound">
            <LevelSettings>
                <telerik:SiteMapLevelSetting Level="0">
                    <ListLayout RepeatColumns="3" RepeatDirection="Horizontal" AlignRows="true"></ListLayout>
                </telerik:SiteMapLevelSetting>
            </LevelSettings>
            <DataBindings>
                <telerik:RadSiteMapNodeBinding NavigateUrl="#"></telerik:RadSiteMapNodeBinding>
            </DataBindings>
        </telerik:RadSiteMap>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?