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

Overview

RadSearchBox supports Server and Client ItemTemplates, as well as DropDown Header and Footer Templates.

If the ItemTemplate is not specified inside the DropDownSettings tag, the items are rendered using their Text property as plain text. If you specify an ItemTemplate, however, the respective template is used for rendering.

The following application scenario shows an example of RadSearchBox using ItemTemplate. Here is a sample markup of a possible usage of server templates.

<telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox1" 
    DataSourceID="SqlDataSource1"
    DataValueField="ProductId"
    DataTextField="ProductName">
    <DropDownSettings Height="400" Width="300">
        <ItemTemplate>
            <asp:Label ID="Label2" Text='<%# DataBinder.Eval(Container.DataItem, "ProductId") %>' runat="server" />
            <asp:Label ID="Label3" Text='<%# DataBinder.Eval(Container.DataItem, "ProductName") %>' runat="server" />
        </ItemTemplate>
    </DropDownSettings>
</telerik:RadSearchBox>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
    SelectCommand="SELECT * FROM [Products]">
</asp:SqlDataSource>
In this article