This is a migrated thread and some comments may be shown as answers.

C# lamda expression to get list of values of cehcked items

0 Answers 63 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Aarsh
Top achievements
Rank 1
Aarsh asked on 26 Feb 2013, 11:26 PM
At the moment I have to break down this simple operation in two parts, I am sure the would be a better way is hiding from me :

List<int> selectedValues= new List<int>();
 
.
.
.
 
IEnumerable<RadComboBoxItem> checkedItems = from checkedItem in cblMagistrateCourts.Items.ToList()
                                                                where checkedItem.Checked == true
                                                                select checkedItem;
                    foreach (RadComboBoxItem item in checkedItems)
                    {
                        if (item.Checked)
                            selectedValues.Add(Convert.ToInt32(item.Value));
                    }

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Aarsh
Top achievements
Rank 1
Share this question
or