Filtering mode not working properly

Hi, I am using combobox over drop down, options are being added to drop down from database.
The problem i am facing is even though i am not setting any default selection a value is getting selected automatically and i have to remove it using backspace for searching other values available in my drop down.

What i really want is that initially there should not be any value in drop down however as soon as i type something or click on toggle i should get values. This i have seen on dhtml demo however its not working in my case.

i am using filtering mode.

var a=dhtmlXComboFromSelect(“dropdown1”);
a.enableFilteringMode(true);

Hi
We need to see your code snippets of init the combo.

Hello,

I am using asp.net with C# and over ASP.net drop down i have build this combobox.

Below is aspx code where i have drop down, in this same file at top i have added all references for using combobox and at end i am calling dhtmlXComboFromSelect method.

Then in code behind i am filling this drop down from database, filling of dropdown1 is dependent drop down2 so i am passing its ID as input in my function which would interect with database and populate values in dropdown1.

DataSet ds = DataClass.DropDownListValues((string)Session[“ConnectionString”], Int32.Parse(dropdown2.SelectedValue));

            DataRow row = null;
            row = ds.Tables[0].NewRow();
            row[0] = "0";
            row[1] = "None";
            ds.Tables[0].Rows.InsertAt(row, 0);

            dropdown1.DataSource = ds;
            dropdown1.DataTextField = "ValueName";
            dropdown1.DataValueField = "ValueID";
            ddlMessage1.DataBind();

Combobox is getting created over drop down however a default value is getting selected automatically which i have not done in my code so everytime i have to use backspace for removing it and search for another item.

Please do let me know your views.

You need to call a.setComboValue("") to “clear” combo’s input after combo’s init.

Thanks Darya for your quick response.

Your solution works however in my case i have two scenerios.

  1. First time user is coming on screen he could search values in drop down and save them.
    i was having problem here because value was coming automatically which has now
    resolved by the solution you have given - thanks.

  2. If user has saved value which he has selected from combobox then next time if he/she is coming on screen he should be able to see what value he/she has selected before. In this case the solution would not work as it would clear the value which is coming from databse to be shown as selected in dropdown.

is there any workaround solution for my 2nd point.

The selection of value of the first item happens, because at the moment of initialization combo takes settings of the select, which chooses the first its item by default. It is the correct behavior of a combo.

Thanks Darya for your help.

Hi Darya,

how we can activate autocomplete mode of combobox ?
in one of my requirement dont want to use filtering mode rather autocomplete, please help me.

Thanks
Yogen

Hi
There is no such opportunity, but you can show all the options after select by opening the list:

combo.attachEvent("onOpen",function(){ window.setTimeout(function(){ var text = combo.getComboText(); combo.setComboText(""); combo.filterSelf(); combo.setComboText(text); },1) });

Thanks Darya for your quick reply.

You are welcome