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

Declarative DataSources

ObjectDataSource:

  • UI for ASP.NET Ajax
  • UI for Silverlight
  • UI for WPF
  • UI for WinForms

SiteMapDataSource:

  • Products
  • Consulting
  • Purchase
  • Support
  • Community
  • Company

SqlDatasource:

  • Politics
  • Sports
  • Events

XmlDataSource:

  • Bold
  • Italic
  • Underline
  • Left
  • Center
  • Right
  • Justify

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

This example demonstrates how to populate RadToolBar from an XMLDataSource, ObjectDataSource, SqlDataSource, and SiteMapDataSource.

Note: Only RadToolBarButtons are populated from a datasource.

  • DefaultVB.aspx
  • ToolBar.xml
<%@ Page AutoEventWireup="true" Inherits="Telerik.QuickStart.QsfPage"  %>

<%@ 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>
</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">
        <h3>ObjectDataSource: </h3>
        <telerik:RadToolBar RenderMode="Lightweight" runat="server" DataTextField="Text" ID="RadToolBar1" DataSourceID="ObjectDataSource1">
        </telerik:RadToolBar>
    </div>
    <div class="demo-container size-medium">
        <h3>SiteMapDataSource: </h3>
        <telerik:RadToolBar RenderMode="Lightweight" runat="server" ID="RadToolBar2" DataSourceID="SiteMapDataSource1">
        </telerik:RadToolBar>
    </div>
    <div class="demo-container size-medium">
        <h3>SqlDatasource: </h3>
        <telerik:RadToolBar RenderMode="Lightweight" runat="server" ID="RadToolBar3" DataSourceID="SqlDataSource1"
            DataTextField="Text">
        </telerik:RadToolBar>
    </div>
    <div class="demo-container size-medium">
        <h3>XmlDataSource: </h3>
        <telerik:RadToolBar RenderMode="Lightweight" runat="server" DataTextField="Text" ID="RadToolBar4" DataSourceID="XmlDataSource1">
        </telerik:RadToolBar>
    </div>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteProductData"
        TypeName="Telerik.Web.Examples.SiteDataItem"></asp:ObjectDataSource>
    <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource1" ShowStartingNode="false">
    </asp:SiteMapDataSource>
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Links] WHERE ([parentId] IS NULL)"></asp:SqlDataSource>
    <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="ToolBar.xml" XPath="//Buttons/Button">
    </asp:XmlDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance