This is a migrated thread and some comments may be shown as answers.

Automatic aropdown after setting default text

2 Answers 46 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Bernie
Top achievements
Rank 1
Bernie asked on 07 Aug 2014, 08:14 PM
Hi!

I'm setting the default text in the radsearchbox serverside. how can I perform a automatic dropdown with search results of the radsearchbox?

is it possible to trigger the ondatarequest event with javascipt?

Thank you!

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 12 Aug 2014, 11:33 AM
Hello,

Straight to your questions:


   1. In order to show a filtered results in the drop down after you set the RadSearchBox text on the server I would suggest the following approach:
//JavaScript
<script type="text/javascript">
    //Put your JavaScript code here.
    function pageLoad() {
        var searchBox = $find("<%= RadSearchBox1.ClientID %>");
        var text = searchBox.get_text();
        if (text != "") {
            searchBox._requestItems(text);
        }
    }
</script>
<telerik:RadSearchBox ID="RadSearchBox1" runat="server"></telerik:RadSearchBox>


   2. Using the RadSearchBox client-side method _requestItems(text) as shown above will make a request to the server in order to retrieve the result set based on the text value set as parameter.

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Bernie
Top achievements
Rank 1
answered on 12 Aug 2014, 11:44 AM
That works great!

Thank you!
Tags
SearchBox
Asked by
Bernie
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Bernie
Top achievements
Rank 1
Share this question
or