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

Declarative Data Sources

ObjectDataSource

SqlDataSource

XmlDataSource

EntityDataSource

RadSearchBox supports binding to various declarative data source controls as ObjectDataSource, SQLDAtaSource, XmlDataSource ,LinqDataSource and EntityDataSource. The items are loaded on demand, and the request for items is initiated by the text typed into the input area, by the user.

  • DefaultVB.aspx
  • searchbox.xml
<%@ Page 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" />
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">

        <div class="demo-container size-thin">
            <h2>ObjectDataSource</h2>
            <telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox4" EmptyMessage="Object"
                DataSourceID="ObjectDataSource1" DataValueField="ID" Width="300"
                DataTextField="Title">
                <DropDownSettings Height="400" Width="300" />
            </telerik:RadSearchBox>

        </div>
        <div class="demo-container size-thin">
            <h2>SqlDataSource</h2>
            <telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox1"
                DataSourceID="SqlDataSource1" Width="300"
                MaxResultCount="10" EmptyMessage="SQL"
                DataTextField="ContactName" DataValueField="CustomerID">
                <DropDownSettings Height="400" Width="300">
                </DropDownSettings>
            </telerik:RadSearchBox>
        </div>
        <div class="demo-container size-thin">
            <h2>XmlDataSource</h2>
            <telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox5" EmptyMessage="XML"
                DataSourceID="XmlDataSource1" DataValueField="Value"
                DataTextField="Text" Width="300">
                <DropDownSettings Height="400" Width="300" />
            </telerik:RadSearchBox>
        </div>

        <div class="demo-container size-thin">
            <h2>EntityDataSource</h2>
            <telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox3" EmptyMessage="Entity"
                DataSourceID="EntityDataSource1" DataValueField="ContactName"
                DataTextField="City" Width="300">
                <DropDownSettings Height="400" Width="300" />
            </telerik:RadSearchBox>
        </div>


        <asp:ObjectDataSource ID="ObjectDataSource1" TypeName="Telerik.Web.Examples.Movie"
            SelectMethod="GetMovieList"
            runat="server"></asp:ObjectDataSource>
        <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CustomerID], [ContactName] FROM [Customers] ORDER By ContactName"></asp:SqlDataSource>
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="searchbox.xml"></asp:XmlDataSource>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
            DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Customers" Select="it.[ContactName], it.[City], it.[ContactTitle]"
            AutoPage="true" OrderBy="it.[ContactName]">
        </asp:EntityDataSource>

    </telerik:RadAjaxPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance