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

Declarative DataSources

ObjectDataSource

  • Amelie
  • East Is East
  • Life Is Beautiful
  • Malena
  • Mulholland Drive
  • O Brother, Where Art Thou?
  • RockNRolla
  • Tales Of The City
  • Trainspotting
  • Vera Drake

SqlDataSource

  • Alice Mutton
  • Aniseed Syrup
  • Boston Crab Meat
  • Camembert Pierrot
  • Carnarvon Tigers
  • Chai
  • Chang
  • Chartreuse verte
  • Chef Anton's Cajun Seasoning
  • Chef Anton's Gumbo Mix
  • Chocolade
  • Côte de Blaye
  • Escargots de Bourgogne
  • Filo Mix
  • Flotemysost
  • Geitost
  • Genen Shouyu
  • Gnocchi di nonna Alice
  • Gorgonzola Telino
  • Grandma's Boysenberry Spread
  • Gravad lax
  • Guaraná Fantástica
  • Gudbrandsdalsost
  • Gula Malacca
  • Gumbär Gummibärchen
  • Gustaf's Knäckebröd
  • Ikura
  • Inlagd Sill
  • Ipoh Coffee
  • Jack's New England Clam Chowder
  • Konbu
  • Lakkalikööri
  • Laughing Lumberjack Lager
  • Longlife Tofu
  • Louisiana Fiery Hot Pepper Sauce
  • Louisiana Hot Spiced Okra
  • Manjimup Dried Apples
  • Mascarpone Fabioli
  • Maxilaku
  • Mishi Kobe Niku
  • Mozzarella di Giovanni
  • Nord-Ost Matjeshering
  • Northwoods Cranberry Sauce
  • NuNuCa Nuß-Nougat-Creme
  • Original Frankfurter grüne Soße
  • Outback Lager
  • Pâté chinois
  • Pavlova
  • Perth Pasties
  • Queso Cabrales
  • Queso Manchego La Pastora
  • Raclette Courdavault
  • Ravioli Angelo
  • Rhönbräu Klosterbier
  • Röd Kaviar
  • Rogede sild
  • Rössle Sauerkraut
  • Sasquatch Ale
  • Schoggi Schokolade
  • Scottish Longbreads
  • Singaporean Hokkien Fried Mee
  • Sir Rodney's Marmalade
  • Sir Rodney's Scones
  • Sirop d'érable
  • Spegesild
  • Steeleye Stout
  • Tarte au sucre
  • Teatime Chocolate Biscuits
  • Thüringer Rostbratwurst
  • Tofu
  • Tourtière
  • Tunnbröd
  • Uncle Bob's Organic Dried Pears
  • Valkoinen suklaa
  • Vegie-spread
  • Wimmers gute Semmelknödel
  • Zaanse koeken

XmlDataSource

  • Amsterdam
  • Barcelona
  • Bonn
  • Boston
  • Brussels
  • Dallas
  • Denver
  • Dublin
  • Liverpool
  • London
  • Madrid
  • Miami
  • Moscow
  • New York
  • Oslo
  • Paris
  • San Francisco
  • Seattle
  • Sofia
  • St.Paul

RadListBox can be bound to all ASP 2.0 and 3.5 DataSource types:

  • AccessDataSource
  • ObjectDataSource
  • XmlDataSource
  • SqlDataSource
  • SiteMapDataSource
  • LinqDataSource
  • EntityDataSource
  • OpenAccessDataSource

All you need to do is set the DataSourceID property of the RadListBox to the ID of the Data Source control. Also, you should set the DataTextField and/or DataValueField properties of the RadListBox to map the Text and Value properties of the Items to the respective columns/fields in the Data Source.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
    • DefaultCS.aspx.cs
    • MovieSample.cs
  • listbox.xml
<%@ Page Inherits="ListBox.Examples.PopulatingWithData.DeclarativeDataSources.DefaultCS"Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true"  %>

<%@ 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-containers">
        <div class="demo-container size-thin">
            <h2>ObjectDataSource</h2>
            <telerik:RadListBox RenderMode="Lightweight" ID="RadListBox1" runat="server" Height="200px" DataSourceID="ObjectDataSource1"
                DataTextField="Title" DataValueField="Id" Width="270px">
            </telerik:RadListBox>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="Telerik.Web.Examples.MovieSample"
                SelectMethod="GetMovieList"></asp:ObjectDataSource>
        </div>
        <div class="demo-container size-thin">
            <h2>SqlDataSource</h2>
            <telerik:RadListBox RenderMode="Lightweight" ID="RadListBox2" runat="server" Height="200px" DataSourceID="SqlDataSource1"
                DataTextField="ProductName" DataValueField="ProductID" Width="270px">
            </telerik:RadListBox>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ProductID], [ProductName] FROM [Products] ORDER By ProductName">
            </asp:SqlDataSource>
        </div>
        <div class="demo-container size-thin">
            <h2>XmlDataSource</h2>
            <telerik:RadListBox RenderMode="Lightweight" ID="RadListBox3" runat="server" Height="200px" Sort="Ascending"
                DataTextField="Text" DataValueField="Value" Width="270px">
            </telerik:RadListBox>
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Listbox/Examples/PopulatingWithData/DeclarativeDataSources/listbox.xml">
            </asp:XmlDataSource>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance