New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnClientRequested
The OnClientRequested client-side event occurs right after the requested items are loaded into the drop-down container.
The event handler receives two parameters:
-
The instance of RadAutoCompleteBox firing the event.
-
An eventArgs parameter containing the following method:
-
get_text() - returns the text currently present in the input area.
-
get_data() - returns an array of the entries in the dropdown.
- length - returns the number of the elements in the dropdown.
This event is used in scenarios when operations need to be preformed to RadAutoCompleteBox right after the data source items are loaded into the drop-down container.
JavaScript
<script type="text/javascript">
function requested(sender, args) {
alert(args.get_text());
}
</script>
ASPNET
<telerik:RadAutoCompleteBox RenderMode="Lightweight" runat="server" ID="RadAutoComplete1" OnClientRequested="requested"
DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID">
</telerik:RadAutoCompleteBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionString %>"
SelectCommand="SELECT [ID], [CountryID], [Name] FROM [Cities]"></asp:SqlDataSource>