RadControls version
|
Q2 2013
|
.NET version |
4.5 |
Visual Studio version |
VS2012
|
programming language |
C#
|
browser support |
all browsers supported by RadControls
|
Project Description.
In this example it is demonstrated how to use the WebAPI to get highlighted search results with the Telerik RadAutoCompleteBox.
A DataSet with System.Data.DataSetExtensions is used to apply LINQ Expressions for the filtering with AsEnumerable().
It's very easy to change the data in the Web API Method to something like the new Entity Framework 6 with Async requests to improve client responsiveness and server scalability. Or even call other WebServices, XML Files on HD or wherever you get your data from.
In this sample it is also added to the JSON Search POST Request some Text from a RadTextBox which is added to every search result.
Instead of RadAutoCompleteContext I it is used dynamic in WebAPI Method combined with Newtonsoft Json.NET JsonConvert.DeserializeObject<dynamic>().
The search results are formatted by ClientDropDownItemTemplate placing metadata in the variables #= Attributes.LOGO_URL # and #= Attributes.RESULT_HTML #.
The selected Entry / Item is kept as Token with a GUID as Value and ShortText for the Token itself.
For IgnoreCase Highlighting of the search terms in the results it is used Regular Expressions / Regex Method in ApiController.