SearchBox - Client-side Templates

Call us at or come to on

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadSearchBox provides support for client templates. The template itself contains mark up and/or binding expressions which are evaluated against a DataItem and then rendered on the client.

  • DefaultCS.aspx
  • scripts.js
  • styles.css
<%@ Page Inherits="Telerik.QuickStart.QsfPage"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBDNoaRkfKhukUEETP32z4GbMssslYELKU&sensor=false"></script>
    <script type="text/javascript" src="scripts.js"></script>
</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 no-bg">

        <telerik:RadODataDataSource runat="server" ID="RadODataDataSource1">
            <Transport>
                <Read Url="http://www.nerddinner.com/Services/OData.svc/" DataType="JSONP"></Read>
            </Transport>
            <Schema>
                <telerik:DataModel ModelID="Dinner" Set="Dinners">
                </telerik:DataModel>
            </Schema>
        </telerik:RadODataDataSource>

        <div class="searchBoxContainer">

            <telerik:RadSearchBox RenderMode="Lightweight" runat="server" ID="RadSearchBox1" Width="350" Skin="Silk"
                DataTextField="Title" OnClientSearch="OnClientSearch"
                ODataDataSourceID="RadODataDataSource1" DataKeyNames="Title" DataModelID="Dinner">
                <DropDownSettings Height="400px">
                    <ClientTemplate>
                    <h3>#= Text #</h3>
                    <div class="details">
                        <img src="icon_list.png" alt="Alternate Text" style="float:left; height:36px; width:36px;" />
                        <span class="info">
                            <p>
                                <b>Hosted By:</b> #= DataItem.HostedBy #<br>
                                <b>Contact Phone:</b> #= DataItem.ContactPhone #
                            </p>
                        </span>
                    </div>
                    </ClientTemplate>
                </DropDownSettings>
            </telerik:RadSearchBox>

        </div>
        <div class="dinnerDetails">
            <h3></h3>
            <p class="description"></p>
            <p>
                Call us at
            <span class="phone"></span>
                or come to
            <span class="address"></span>
                on <span class="date"></span>
            </p>
        </div>
        <div class="map">
        </div>
    </div>

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

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?