Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > using a ListBox with SelectionMode="Multiple" in a linq query

Reply
Thread Tools

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

 
 
Seb
Guest
Posts: n/a
 
      05-12-2008
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(SubA ctivityId)

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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq or not Linq George ASP .Net 4 11-05-2008 04:53 PM
HowTo? LINQ Query Table Name (Range Variable) Not Known Until Runtime Joey ASP .Net 1 04-23-2008 04:33 PM
SQL Query to Linq (Group By and Sum) Alex Sauceda ASP .Net 6 02-04-2008 10:26 PM
LINQ Query shapper ASP .Net 2 10-18-2007 02:59 PM
Please translate this C# LINQ query into VB for me !!!!! ChrisN ASP .Net 1 08-07-2007 07:29 AM



Advertisments