I'm looking at binding a DataTable to the drop down. There are 2 columns (Code and Name) in the DataTable and 1,400+ rows.
Ideally, I want to be able to search as you type. But it seems to take forever to do it. I am binding in code to do this when the page is loaded using the following simple 3 lines:
WebDropDown1.DataSource = ds.Tables(0)WebDropDown1.TextField = "Code"WebDropDown1.DataKeyFields = "Code"
Is there a fast way to do this when running (or any suggestions) ?
Can you display Code and Name in the dropdown portion? I've looked at the WebCombo which pretty much displays what I want but is slow also - and I can't see how to implment search as you type.
Any pointers would be good thanks.
You should not rebind on every Page_Load. You should check whether the request is postback, and only if it is initial page load, databind and set a DataSource.
Client side filtering and LoadOnDemand are not compatible. Client-side filtering only filters on the client, while load on demand does an AJAX request to fetch more data from the server.
Moreover, client filtering will load and create all items at once on the client.
I would suggest using Server filtering with LoadOnDemand=True, and a reasonable PageSize setting. If you only set EnableAutoFiltering="Server", you do not need any code in the code behind. You can also use the paging functionality. Both paging and load on demand work fine with server-side filtering.
What is your current value for PageSize ? If it is zero, all items will be loaded anyway.
I hope this helps. Thanks for the feedback,
I've decided to use the WebCombo as it is giving good performance and a reasonable TypeAhead for our data. Overall it seems easier to use. I will experiment a little more with the WebDropDown when I get some time.
Cheers for the help
Thanks for your feedback. Could you list the main drawbacks you see with the current WebDropDown for your scenario, when you compare it with the WebCombo ?
Did you also try the Paging and LoadOnDemand features of the WebDropDown?
I'm wondering if there is any improvement to the WebDropDown since Andez post? I agree with Andez that the WebCombo has much better performance. The typeahead functionality works, there are no delays in finding data and can handle large datasets. I have been setting different properties as you've outlined and can find no combination of them that makes the WebDropdown work efficiently with a dataset that has 3000 records.
Did you try EnableLoadOnDemand=true, and set some PageSize value , say 200 or 300 , even 500 ? Performance should be pretty good in that case.
Also by Typeahead support I assume you have set EnableAutoFiltering=Server.
By the way, in the WebCombo if you have the following set:
Webcombo1.DropDownLayout.RowsRange = <some number>;
it's essentially the same as enabling LoadOnDemand and setting PageSize=<the same number>;
I've had a bit more play with the combos today. I was getting reasonable performance from each, but then went a little mad by adding lots of data to each. I've compared both and they both offer good performance.
I've put together some sample code which I will upload if anyone is interested. I will post my results also of the comparison when I get a chance.
I've only just noticed that some script errors were occuring when I was clicking on the drop down (both WebCombo and WebDropDown) which I have never noticed before so don't know if I'm going mad cos it has been a long day or I have set some properties somewhere that may form a bad combination.
From todays tests, the only drawback of the WebDropDown appears to be it only displays single column of data.
This is really cool that you have done this research , thanks :)
By the way you can have multi-column WebDropDown as well. There are two ways to do this:
1) to use ItemTemplate, or even different Template for each item
2) to have 1 item which will be assigned a WebDataGrid template, i.e. you can have a WebDataGrid inside the dropdown.
There are samples for both of these approaches at samples.infragistics.com => 2009.1 => WebDropDown => Templates.