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

Declarative Data Sources

ObjectDataSource

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

SiteMapDataSource

  • 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

XmlDataSource

  • 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..

EntityDataSource

  • cv
    • vcxvcvcv

RadNavigation 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, RadNavigation automatically creates the Navigation node 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 RadNavigation 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 Navigation Nodes.

RadNavigation supports binding to an ObjectDataSource as well. In addition to the standard Navigation Node 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, RadNavigation can create a hierarchy of its Nodes.

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

For more details on the aforementioned algorithm, you can read the following article - Binding to object-based data sources .

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
  • Navigation.xml
<%@ Page Title="" Language="VB"  AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Navigation_Data_Binding_Server_side_Binding_Declarative_Data_Sources_DefaultVB" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container size-medium">
        <h2>ObjectDataSource</h2>
        <telerik:RadNavigation runat="server" ID="RadMenu4" DataSourceID="ObjectDataSource1" DataTextField="Text"
            DataFieldID="ID" DataFieldParentID="ParentID" Style="z-index: 7" EnableRoundedCorners="true"
            EnableShadows="true" EnableTextHTMLEncoding="true">
        </telerik:RadNavigation>
    </div>

    <div class="demo-container size-medium">
        <h2>SiteMapDataSource</h2>
        <telerik:RadNavigation runat="server" ID="RadMenu2" DataSourceID="SiteMapDataSource1" Style="z-index: 600"
            EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">
        </telerik:RadNavigation>
    </div>

    <div class="demo-container size-medium">
        <h2>XmlDataSource</h2>
        <telerik:RadNavigation runat="server" ID="RadMenu3" DataSourceID="XmlDataSource1" DataTextField="Text"
            Style="z-index: 4" EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">
        </telerik:RadNavigation>
    </div>

    <div class="demo-container size-medium">
        <h2>EntityDataSource</h2>
        <telerik:RadNavigation runat="server" ID="RadMenu5" DataSourceID="EntityDataSource1" DataTextField="Text"
            DataFieldID="id" DataFieldParentID="parentId"
            Style="z-index: 3" EnableRoundedCorners="true" EnableShadows="true" EnableTextHTMLEncoding="true">
        </telerik:RadNavigation>
    </div>

    <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="~/Navigation/Data-Binding/Server-side-Binding/Declarative-Data-Sources/Navigation.xml"
        XPath="/Navigation/Item"></asp:XmlDataSource>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteData"
        TypeName="Telerik.Web.Examples.SiteDataItem"></asp:ObjectDataSource>

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

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance