Populating ComboBox with "ALL" option
-
Hi, I have a combo box which I am populating dynamically using Datatables. The combobox acts as a selection point from where a user selects a value and accordingly charts are generated..! The column i am populating changes dynamically and is never the same. Now I want to add another option "ALL" in the combo box after/before I populate the combobox...such that my combo box should have all the values frm table as well as an item " ALL " I tried doing it, but it shows error. Can anyone help me out please. how should i go abt it..? I am making a Windows Application using C#. Cheers
Jimish
-
Hi, I have a combo box which I am populating dynamically using Datatables. The combobox acts as a selection point from where a user selects a value and accordingly charts are generated..! The column i am populating changes dynamically and is never the same. Now I want to add another option "ALL" in the combo box after/before I populate the combobox...such that my combo box should have all the values frm table as well as an item " ALL " I tried doing it, but it shows error. Can anyone help me out please. how should i go abt it..? I am making a Windows Application using C#. Cheers
Jimish
One thing you could do is to modify the SQL query so that 'ALL' is in the datatable. I.e. " SELECT Value1 FROM Table1 UNION ALL SELECT 'ALL' " Then the option value will be in the datatable and you can select it.
-
One thing you could do is to modify the SQL query so that 'ALL' is in the datatable. I.e. " SELECT Value1 FROM Table1 UNION ALL SELECT 'ALL' " Then the option value will be in the datatable and you can select it.
-
Hi, I have a combo box which I am populating dynamically using Datatables. The combobox acts as a selection point from where a user selects a value and accordingly charts are generated..! The column i am populating changes dynamically and is never the same. Now I want to add another option "ALL" in the combo box after/before I populate the combobox...such that my combo box should have all the values frm table as well as an item " ALL " I tried doing it, but it shows error. Can anyone help me out please. how should i go abt it..? I am making a Windows Application using C#. Cheers
Jimish
Hi, After binding your datatable / dataset to Combobox. Add below line. cmBOX.Items.Insert(0,"ALL");
Thanks, Sun Rays To get something you must have to try once. My Articles
-
Hi, After binding your datatable / dataset to Combobox. Add below line. cmBOX.Items.Insert(0,"ALL");
Thanks, Sun Rays To get something you must have to try once. My Articles