The SearchBox has two distinctive modes, with and without AutoComplete enabled. If this feature is not enabled the use of the control is quite straight-forward. The user types text and then presses enter or clicks on the search button, which fires an event where the entered text could be obtained.
When the autocomplete is enabled the situation is a bit different. A list with filtered data will be shown beneath the input as the user types in:
With autocomplete enabled the following set of features are available:
• MaxResultCount – this property will define the number of results displayed in the drop-down which is very useful when searching among a big set of records. Of course, if you want to see all results, you just have to click the “Show All Results“ button, and yes, it is localizable.
• MinFilterLength – with this property you could define the minimum number of symbols which has to be entered before a search operation is triggered.
• Filter – as in the rest of our controls the filter could be either StartsWith or Contains.
• Templates – both client and server ones, as well as Header and Footer templates for full drop-down customization.
Check out the complete list of features of our ASP.NET Search Box control.
Good question indeed, each result could have Text and Value defined through the DataTextField and DataValueField properties. But what if we need to assign more information? Here comes the DataKeyNames collection. With this collection you can define the different fields of the data-set which need to be associated with each result.
As some of you might wonder what these two icons are for (the globe and the star), you should know that they are image buttons. This brings us to one of the other major features of the control - the button collection.
RadSearchBox for ASP.NET AJAX provides the user with the ability to define custom image buttons which may be used in various scenarios. “But how to use them?” - you might wonder. Every button has a command name and command argument which could be obtained in the events which are fired upon button click. Following the pattern from the rest of our controls, there is client-side as well as servers-side event. Each button could be shown either to the left or to the right of the input, and this could be controlled through its Position property.
Yes it is, both when filtering data on the server or loading it from a web service. This was the main idea of the control, to provide results as the user types in even when working with big data sets. The control has the additional option of letting you filter the results directly on the SQL server (or any other DataSource) for maximum performance.
Last but not least don’t miss the chance to register for our What’s New Webinar on Mar 5th. Our evangelist Jeff Fritz will walk you through all the new stuff and you can get answers to your questions live. Just for fun, some of you attending the live event will walk away with a Telerik .NET Ninja t-shirt and a ThinkGeek gift card.
Dimitar Terziev is a software developer at one of Telerik's ASP.NET AJAX teams, where he is responsible for RadScheduler, RadMenu, RadTabStrip and RadPanelBar. In his free time he enjoys swimming, skiing and playing with his dog.
Subscribe to be the first to get our expert-written articles and tutorials for developers!