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

Discussion in 'ASP .Net' started by Seb, May 12, 2008.

  1. Seb

    Seb Guest

    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
     
    Seb, May 12, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    21,263
    Hero Ngan
    Nov 13, 2003
  2. Fabio Visin
    Replies:
    3
    Views:
    1,288
    Steven Cheng
    Feb 21, 2008
  3. George

    Linq or not Linq

    George, Nov 4, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    369
    Mike Gleason jr Couturier
    Nov 5, 2008
  4. Matthew Louden
    Replies:
    1
    Views:
    204
    Hero Ngan
    Nov 13, 2003
  5. Calendar SelectionMode

    , May 30, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    138
Loading...

Share This Page