<%@ Page Language="C#" AutoEventWireup="true" Inherits="Telerik.QuickStart.QsfPage" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<
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"
/>
<
qsf:MessageBox
ID
=
"InformationBox1"
runat
=
"server"
Icon
=
"Info"
Type
=
"Info"
>
Search products by using RadSearchBox and choose the supplier
from the SearchContext to narrow the results in the auto-complete drop down.
</
qsf:MessageBox
>
<
div
class
=
"demo-container size-narrow"
>
<
telerik:RadSearchBox
RenderMode
=
"Lightweight"
ID
=
"RadSearchBox1"
runat
=
"server"
Width
=
"500"
DropDownSettings-Height
=
"200px"
DataSourceID
=
"SqlDataSource1"
DataTextField
=
"ProductName"
DataValueField
=
"ProductID"
DataContextKeyField
=
"SupplierID"
>
<
SearchContext
DataSourceID
=
"SqlDataSource2"
DataTextField
=
"ContactName"
DataKeyField
=
"SupplierID"
OnClientItemSelected
=
"OnClientItemSelected"
>
</
SearchContext
>
</
telerik:RadSearchBox
>
<
ul
class
=
"itemslist"
></
ul
>
<
script
>
function OnClientItemSelected(sender, args) {
var $content = $('<
span
class
=
"item"
>Selected user name: <
strong
>' + args.get_text() + '</
strong
>, Supplier ID Key: <
strong
>' + args.get_key() + '</
strong
>, Is Default: <
strong
>' + args.get_isDefaultItem() + '</
strong
></
span
>');
var $listEl = $('<
li
></
li
>').append($content);
$('.itemslist').append($listEl);
}
</
script
>
</
div
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductId], [ProductName],[SupplierID] FROM [Products]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT TOP 10 [SupplierID], [ContactName] FROM [Suppliers]"></
asp:SqlDataSource
>
</
form
>
</
body
>
</
html
>