Hey all,
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.
Hi,
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,
Angel
Angel,
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
Andez
Hi Andez,
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.
Best,
I've found that sample now thank you. What would be good with the Infragistics controls is a how to unless I've overlooked it. It's ok checking the code but that gives you an as is. I like to see something that explains the steps to achieving the goals. Just a thought to improve things.
I'll look into the templates and try to put something together on top of what I have already then post it on here.
Cheers,
Indeed I did overlook it.
Template overview can be found in the Developers Reference in the online documentation:
https://www.infragistics.com/help/aspnet/webdropdown-templating
Hi Guys,
I thought I'd play with the grid a bit more and went back to the drawing board. Think I may have hit a same problem as yourself Mark.
I'm setting my page size to 200. When the page loads, it loads very fast. Then when I expand the drop down, I get the javascript error. The drop down just crashes. I've played with the properties and I have tried various combinations of the following:
EnableAnimations = FalseEnableClosingDropDownOnBlur = TrueEnableClosingDropDownOnSelect = True' Performance Related SettingsEnableAutoFiltering = ServerEnableLoadOnDemand = TruePageSize = 300
Any ideas? I've attached the offending pages in a zip file.
I looked at your sample - the WebDataDropDownSimpleFilter.aspx. There you have EnableLoadOnDemand=true, and the javascript error is thrown when you scroll down (i.e. when load on demand is invoked). I don't get any javascript error as soon as i open the dropdown.
The issue here is that the dropdown doesn't have any DataSource assigned, and it's only bound on the first page load - but LoadOnDemand will call DataBind() on every load on demand operation (which is because the datasource changes with the newly added items). Since on this load on demand operation, there is no data source assigned, it doesn't bind anything.
in the VB.NET code behind, if you comment this line everything will work fine:
' If Not Me.IsPostBack Then
(i.e now it will data bind on every postback, so that load on demand can correctly mark how many dropdown item objects to create and data bind, from the real data source underneath).
Hope this helps,
Hi Angel-
I did have the databind inside "if not ispostback". I took that line out and the control is working much better and the performance is now actually faster than the webcombo, which is what I was looking for. The webcombo works but I thought it was probably a little slower (due to the webgrid) than what the webdropdown should be.
Thanks to both you and Andez!
Mark
Hi Angel and Andez-
By the way I idid originally try using the dropdown with an ObjectDataSource bound to a Generic Collection for my datasource rather than binding it to a dataset in the code behind, and I seemed to have problems with it binding properly. I'll test it again now that these other problems have been worked out.
I tested with an ObjectDataSource and it's no good. It doesn't like the Generic Collection and putting it into the Object causes other features to fail.
Think that should be ok Mark.
Just did a quick test with a simple Period class in a generic list and it binds fine without any problems. Didn't use the ObjectDataSource for it mind.
Is it mandatory to have the data binding code always in the "page_load" event with no "Page.IsPostBack" check?
I have more than 8 WebDropDown controls on a page. When the user scrolls down to the end of the list in one of the WebDropDown control, how will be the remaining webDropDown controls behave? Does all the WebDropDown controls make a database roundtrip or only the user selected WebDropDown control will do?
My concern is - I have other events on the page that causes a postback, so everytime the WebDropDown databinding code in the "page_load" will fire. How can I avoid this?
Thanks