Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, can anyone please help me here with this issue. I want to use DropDownCheckBoxes in my application, when I do a multiple selection, I am getting only the first selected value the remaining values are not appearing. Could you please help me on how I should store all the selected values in database? i don't know how I should store them in the database. The following is what I wrote from code behind.
chList= DropDownCeheckBoxesListControl1.SelectedItem.Text
Thank you.
Posted
Updated 31-Dec-13 9:54am
v3
Comments
Sergey Alexandrovich Kryukov 31-Dec-13 15:41pm    
Don't store controls in database, store data...
—SA
Member 10215709 31-Dec-13 15:57pm    
I want to get all the selected items and store them in database. the problem is that when select I am getting only the first value. could you please help me?
Sergey Alexandrovich Kryukov 31-Dec-13 20:13pm    
Help with what? Store the data you want to store. Only the first value? The answer is: you screwed up. I don't know where, because, due to approaching New Year, my access to your hard drive through the chimney is somewhat limited... :-)
—SA
ZurdoDev 31-Dec-13 20:24pm    
Don't use SelectedItem. You want to iterate through the items and find the ones selected.

1 solution

As you are doing DropDownCheckBoxes, so you must be doing something to bind CheckBoxes to the DropDownList items.

So, if you code the following...
C#
chList= DropDownCeheckBoxesListControl1.SelectedItem.Text

It will always return one item.

You need to loop through those CheckBoxes, which are appended to DropDownList items and check which one are checked. That will return you all the selected items.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900