Last week we wrote about our new ASP.NET DropDownList control
taking some specific functions of our existing ComboBox control
, but in a more lightweight and better performing manner. Continuing this trend, it’s time to introduce another of the new members of Telerik’s ASP.NET control suite
– the SearchBox
What does RadSearchBox do and how it could help you do your tasks?
Every once in a while a client of ours is trying to use either our ASP.NET ComboBox
components as a search box control. Even though this functionality could be achieved with both controls, it’s either too complicated to implement or the client demands features which are not available. This is why we have decided that it’s time for a separate control dedicated to this one and only purpose - to make the search an easy task. With that in mind, we have made a fast, intuitive and easy to use search box control.
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.
What will happen when you select a result from the drop-down?
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.
What is this Button Collection and how to use it?
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.
Is it fast?
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.
What do you think of our new control and do you find it useful?
As usual we encourage you to download and try our newest Beta release, so please do so and drop us a line in the beta forums to help us ship an even better official version on February 20th.
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.