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.
OK, I was not sizing the maximum drop down height so the page was huge. If we set the max drop down height, the performance increases slightly, although search as you type is slow.
New Unit(100, UnitType.Pixel)
This is the only code I have added. I still have the default settings on the WebDropDown.
Also tried the following:
EnableAnimations = FalseEnableAutoFiltering = ClientEnableCachingOnClient = TrueEnableLoadOnDemain = True
Now the WebDropDown is behaving quite reasonably. However, when I close IE I get the annoying message of:
Stop running this script?
A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.
This always happens after the page is loaded and I just want to close it.
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?