using a ListBox with SelectionMode="Multiple" in a linq query

S

Seb

As of now I use the code below...
var queryPoints = from ad in this.db.ActivityDatas
where ad.SubActivityId ==
int.Parse(SubActivityId.SelectedItem.Value) //only one selected
activity
select new
{
...
...

However only one selection form the listbox is used in the where
clause.
I have tried with the following and several others... however I cant
seem to find they right syntax


SubActivityId.Items.Cast<ListItem>().Contains(new ListItem() { Text =
ad.SubActivity.Name, Value = ad.SubActivityId.ToString() })
and
SubActivityId.Items.Cast<ListItem>().Contains(SubActivityId)

And numerous others...

it's the items with SubActivityId.Items[x].Selected == true I want to
compare SubActivityId.Items[x].Value with ad.SubActivityId on. Hope I
make sense...


best regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top