开发者

AjaxControlToolkit combobox substitute for a large number of items

开发者 https://www.devze.com 2023-04-02 04:33 出处:网络
I have a location using our ASP.NET 4.0 web application which was running fine for about 2 years. I went out on site to do an upgrade and found that one of the pages would just be blank and IE 8 would

I have a location using our ASP.NET 4.0 web application which was running fine for about 2 years. I went out on site to do an upgrade and found that one of the pages would just be blank and IE 8 would completely stop res开发者_JAVA技巧ponding. Upon investigation I found that one of the comboboxes on a page had over 8000 items. The page loaded fine in IE7, IE9, Firefox, and Chrome. I looked at the documentation at that Ajax Control Toolkit site and they say that I should be using the Auto Complete Extender since I have such a high number of records. I figure it is only a matter of time before it doesn't work in any browser. The facility uses IE8, so I currently have them running in compatibility mode; I then told them to start deleting old records that they don't need anymore. However, I need to begin working on a substitute. The problem with the Auto Complete Extender is that it doesn't work anything like the combobox. Does anyone know of a good approach? I need to keep the DataSource and DataBinding style in the code-behind. Also, redesign is not an option. I need that list to contain all Visitors for any given facility.


With 8000 items I would recommend a control that is both populated and filtered on demand (not on Page_Load), and doesn't persist all items to ViewState.

Unfortunately, populating and filtering on demand runs against keeping the DataSource and DataBinding style intact. What remains is trying to use the control with EnableViewState="false" and minimizing the page size by all means available, first and foremost by using compression. In IIS, enable dynamic compression. I don't think that these steps are going to solve the performance problem, but you should start with analyzing the page size with YSlow or other tools. For example, if the page has optional elements, like customer specific comboboxes, make sure that only those that are in use are actually populated. I have had situations where I've been able to more than half the page size by not populating the unused controls and disabling ViewState for them. Setting Visible="false" was not enough.

As for alternatives, I have used Telerik RadCombobox with with similar item counts and performance problems. Setting EnableViewState="false" improved postback speed significantly, but load times were still not acceptable. Switching to load on demand helped, but introduced new problems with persisting the selected state without ViewState. Populating the combobox on demand on means that databinding is performed in a ItemsRequested event, each time the combobox is opened in the UI. This is about the same as using an ordinary TextBox with AutoCompleteExtender and a page method. You probably could reuse most of the Page_Load time databinding code here.

Overall, I have had the best experience with jQuery UI autocomplete and Ajax requests, but this would involve a more extensive redesign.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号