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

dynamic load

8 Answers 194 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Raphaël MANSUY
Top achievements
Rank 1
Raphaël MANSUY asked on 26 Jul 2012, 10:27 AM
Hi,

Your new control is great ;)
I'd like to load the dropdown's items dynamically when the user types letters. So each time the user types a letter, a callback would be made to load the dropdown's content.
Is there a built-in feature for that? otherwise, what would be the easiest way to achieve that?
Thanks

8 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 02 Aug 2012, 05:55 PM
Hello  Raphael,

RadAutoCompleteBox works just the way you have described, it filters the datasources using a callback after each letter the user has type. You can easily verify that using a tool like fiddler or FireBug. Are there any issues that you have faced upon using the callback filtering?

Kind regards,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Raphaël MANSUY
Top achievements
Rank 1
answered on 02 Aug 2012, 06:04 PM
No, it's fine. I hadn't look in details to your control ;)
0
Genady Sergeev
Telerik team
answered on 03 Aug 2012, 10:11 AM
Hi Raphael,

We are glad that you like it. :) Don't hesitate to drop us a line if you face any issues with the AutoCompleteBox.

Greetings,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Darren
Top achievements
Rank 2
answered on 20 Sep 2012, 04:23 PM
I am having a rough time doing what you are describing here.

For example, I'm creating an employee search where I have close to 20,000 employees to load. Of course, I don't want to load all 20,000 employees when the page loads. I don't want to load any data until the user starts to type. I tried to do this using a parameter (that was bound to the RadAutoCompleteBox control) of the sql data source control the RadAutoCompleteBox is bound to. Because the RadAutoCompleteBox is empty when the page loads, it goes out and pulls all the records which takes quite a while. Also, when the user starts to type, no results start to show up for about 30 seconds. 

My first thought is to somehow tell the RadAutoCompleteBox not to load data or filter anything until the user types in at least 3 characters. Is this possible? 

Also, the TextChanged event doesn't seem to fire and I have autopostback set to true. Because of this, it doesn't seem to be updating the where clause the sql data source is using dynamically. 

Thanks guys! 

0
Genady Sergeev
Telerik team
answered on 25 Sep 2012, 03:24 PM
Hi Raphael,

When TextMode is set to token AutoCompleteBox will not fire the Text_Changed event. However, you can still access the text entered in the auto complete via its Text property. Then you can use that text to filter the data source before assigning it to the AutoCompleteBox. Here is example code:

protected void Page_Init(object sender, EventArgs e)
    {
        if (Page.IsCallback)
        {
            AutoCompleteBox1.DataSource = FilteraDataBase(AutoCompleteBox1.Text);
        }
    }


Greetings,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Lee Nessling
Top achievements
Rank 1
answered on 07 Jan 2015, 04:47 PM
I'm attempting to filter the datasource based on the Text in the Autocomplete, however AutoCompleteBox1.Text = ""

I don't see how to retrieve the Text of what the user keyed to filter the result set.

0
Hristo Valyavicharski
Telerik team
answered on 12 Jan 2015, 01:32 PM
Hi Lee,

AutoCompleteBox should filter the text automatically. Can you paste your code here? 

Thanks.

Regards,
Hristo Valyavicharski
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
Lee Nessling
Top achievements
Rank 1
answered on 14 Jan 2015, 11:02 PM
Either I didn't see it before, or it's new since I first coded these controls, but I fixed the issue by using DataSourceSelect
 event.

The new code is now :    

  void AutoCompleteBox_DataSourceSelect(object sender, Telerik.Web.UI.AutoCompleteBoxDataSourceSelectEventArgs e)
        {
            AutoCompleteBox.DataSource = GetDataSource(e.FilterString);
        }
Tags
AutoCompleteBox
Asked by
Raphaël MANSUY
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Raphaël MANSUY
Top achievements
Rank 1
Darren
Top achievements
Rank 2
Lee Nessling
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or