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

Client-side Templates

RadNavigation now supports client templates when it is bound to ClientDataSource. The templates are declared in the ClientNodeTemplate tag and support the following expressions for evaluating code:

  • #= ... # - Data - Evaluates the JavaScript code expression or a string property from the data item and outputs the result in the template.
  • # ... # - Code - Evaluates the JavaScript code expression inside. Does not output value.
  • #: ... # - HTML-encode - Same as the data expression, but HTML-encodes the result.

The templates are applied automatically to all items loaded from the ClientDataSource. To apply different client template to an item, you can use the onClientTemplateDataBound() event where you can pass a different HTML for the template:

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • Styles.css
<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Navigation_Functionality_Server_side_Templates_Item_Templates_DefaultCS" %>

<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script type="text/javascript" src="scripts.js"></script>
    <link rel="stylesheet" type="text/css" href="Styles.css" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container no-bg">
        <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
        <div class="demo-container size-narrow">
            <telerik:RadNavigation ID="RadNavigation1" runat="server" OnClientTemplateDataBound="onClientTemplateDataBound"
                ClientDataSourceID="RadClientDataSource1" DataTextField="Name" DataFieldID="ID"
                    <span class="imgWrap">
                    <img alt="#= Text #" src="Images/#= Text #.png" />
                    <span class="templateText">#= Text #</span>
        <script type="text/javascript">
            Sys.Application.add_load(function() {
                var clientDataSource = $find('<%=RadClientDataSource1.ClientID%>');


Support & Learning Resources

Find Assistance