12/09/2009

How to enter free text in a ajax asp.net combo box ?

A day before I had requirement where the user wants a combox box that gives him access to enter free text also inside it. Thanks to Ajax Control Toolkit which is a open source that lets us modify the code according to our requirements . So How do we let the user enter free text in a ASP.NET AJAX combo box ?

1. Download the source code for AJAX control toolkit from here .
2. Once you open the solution, Under Ajax Control toolkit you will find a folder 'ComboBox'
3. In that try to open Combobox.debug.js . If you dont have it , open Comboxbox.js .
4. Now try to find the following piece of code in it and comment it.

if (this.get_selectedIndex() == -1 && this.get_dropDownStyle() == AjaxControlToolkit.ComboBoxStyle.DropDownList) {
this.get_textBoxControl().value = '';
e.preventDefault();
e.stopPropagation();
return false;
}
This code is basically responsible to prevent entering free text when you dont have any item in the list that matches with what you had typed.

5. Now build the solution, add a reference to the dll , add the combo box control to your web page and you should be able to enter free text in ComboBox.

If you encounter any errors, throw a comment.I will help you out.

Want to know more on ASP.NET ajax, Subscribe here or click here to get updates via email

5 comments:

thanks a lot for sharing this unique information.

Once you have made your pick, it is ideal to take good care of louis vuitton by ensuring that the leather is not exposed to harsh elements so as to preserve louis vuitton handbags . In connection to this, it is also ideal to note that Monogram Mini Lin are availed in a in a wide array of colors and as such, you should make your pick of Monogram Miroir in accordance to your taste.

This is one of those posts that makes me happy. It glitters and glows with all of your excitement about everything going on -- and I totally get it.

This works perfectly. I can now enter text into my combo box and I do not need to resort to html anymore.

Nhân sâm đỏ Hàn Quốc các phương pháp ăn, tác dụng và những điều cần kiêng kỵ
Hồng sâm có nhiều cách chế biến khác nhau, mỗi một cách chế biến có thể mang lại những hiệu quả sức khỏe khác nhau. Mặc dù chúng ta đều biết rằng hồng sâm là một thành phần dược liệu rất bổ dưỡng nhưng nó có thể gây ra những tác dụng phụ nếu như bạn không biết cách tiêu thụ nó. Có một vài điều cấm kỵ về việc ăn hồng sâm mà bạn nên chú ý, bạn có thể tìm hiểu rõ hơn ở trong bài viết này.
Nguồn: ** https://samyennhatminh.com/nhan-sam-tuoi-han-quoc

Post a Comment