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

Data Source Control


  • UI for ASP.NET Ajax
    • Grid
    • Scheduler
    • Editor
  • UI for Silverlight
    • Grid
    • Menu
    • Editor


  • Products
    • UI for ASP.NET AJAX
    • UI for WinForms
    • UI for WPF
    • UI for Silverlight
    • Reporting
    • Data Access
    • Sitefinity ASP.NET CMS
    • Test Studio
  • Consulting
    • On-site Training
    • Consulting Express
    • Open Classes Training
    • Online Training
    • Project Consulting
    • Telerik Webinars
  • Purchase
    • Buy Now
    • Renewals & Upgrades
    • License Agreement
    • FAQ
    • Purchase Orders
    • Contact Sales
  • Support
    • Support by Product
    • Documentation
    • Demos
    • Knowledge Base
    • Telerik Trainer
    • Videos
    • Skins
  • Community
    • Forums
    • Blogs
    • Events
    • Code Library
    • Learning Resources
    • Announcements
    • Free Products
  • Company
    • About Telerik
    • Press Center
    • Careers
    • Contact Us


  • Politics
    • CNN
    • NBC
    • ABC
  • Sports
    • US Sports
      • Baseball
      • Football
      • BasketBall
    • European Sports
      • Soccer
      • Volleyball
  • Events
    • Oscar Awards
    • MTV Movie Awards


  • File
    • New
    • Open
    • Save
    • Save As
    • Print Preview
    • Print
    • Close
  • Edit
    • Undo
    • Cut
    • Copy
    • Paste
    • Clipboard...
  • Insert
    • Break...
    • Page Numbers...
    • Date and Time...
    • Field...
    • Symbol...
    • Comment
    • Picture
    • Diagram
    • Text Box
    • Hyperlink
  • Format
    • Font
    • Paragraph...
    • Bullets and Numbering...
    • Borders and Shading...
    • Columns
    • Tabs
    • Change Case
    • Background
    • Theme
    • Frames
    • Autoformat
  • View
    • Normal
    • Web Layout
    • Print Layout
    • Task Pane
  • Tools
    • Spelling And Grammar...
    • Research...
    • Language
    • Word Count...
    • Track Changes
    • Compare And Merge Documents..


RadMenu supports binding to various types of data sources, including declarative datasources.

Some of the declarative data sources are inherently hierarchical. That includes SiteMapDataSource and XmlDataSource. When data-bound to these types of data sources, RadMenu automatically creates the menu item hierarchy. There is no need to use the DataFieldID and DataFieldParentID properties.

The AccessDataSource is a table-based DataSource component. It can be used to bind the menu declaratively at design time. As with binding to a DataSet, DataTable, or DataView, you can use the ID-ParentID relation to establish a hierarchy among menu items.

RadMenu supports binding to an ObjectDataSource as well. In addition to the standard Menu Item properties (Text, Value, Navigate Url, etc.) that can be bound to the underlying business objects, the DataFieldID and DataFieldParentID properties can be specified, too. In this way, RadMenu can create a hierarchy of its Items.

Still, the business objects should provide the data needed for the RadMenu to build the hierarchy. If the ParentID property of the business objects are of nullable or reference type, then null values denote root Menu Items. In case, the ParentID property is of value type (Integer, Guid, etc.), '0'/'Guid.Empty' values denote the root Menu Items.

For more details on the aforementioned algorithm, please read the documentation topic - Binding to object-based data sources.

  • DefaultCS.aspx
  • Menu.xml
<%@ Page  %>

<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container size-wide">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu4" DataSourceID="ObjectDataSource1" DataTextField="Text"
            DataFieldID="ID" DataFieldParentID="ParentID" Style="z-index: 7" EnableRoundedCorners="true"
            EnableShadows="true" EnableTextHTMLEncoding="true">

    <div class="demo-container size-wide">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu2" DataSourceID="SiteMapDataSource1" Style="z-index: 6"
            EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">

    <div class="demo-container size-wide">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu1" DataSourceID="SqlDataSource1" DataFieldID="id"
            DataFieldParentID="parentID" DataTextField="Text" Style="z-index: 5" EnableRoundedCorners="true"
            EnableShadows="true" EnableTextHTMLEncoding="true">

    <div class="demo-container size-wide">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu3" DataSourceID="XmlDataSource1" DataTextField="Text"
            Style="z-index: 4" EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">

    <div class="demo-container size-wide">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu5" DataSourceID="EntityDataSource1" DataTextField="Text"
            DataFieldID="id" DataFieldParentID="parentId"
            Style="z-index: 3" EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">

    <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource1" ShowStartingNode="false"></asp:SiteMapDataSource>

    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT id, text, parentId from Links"></asp:SqlDataSource>

    <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="~/Menu/Examples/Programming/DeclarativeDataSources/Menu.xml"

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteData"

    <asp:EntityDataSource runat="server" ID="EntityDataSource1" ConnectionString="name=TelerikReadWriteEntities"
        DefaultContainerName="TelerikReadWriteEntities" EntitySetName="Links">


Support & Learning Resources

Find Assistance