DanJourno
asked on
Using a Checkedlistbox in a Linq statment
Hi,
I'm new to the world of Linq and trying to figure something out.
I've got a CheckedListbox which has been populated like this:-
After the user checks some items, I want to take the checked items, and perform a new Linq statement like this:-
However, Product.CategoryID is an integer, and lstCategories.CheckedItems can contain multiple items.
I believe I have to convert lstCategories.CheckedItems into a collection to be used in the Linq statement, but I have no idea how to go about it.
Can anyone help?
Thanks
Dan
I'm new to the world of Linq and trying to figure something out.
I've got a CheckedListbox which has been populated like this:-
Dim Categories = From Category In _DB.CategoriesTable Order By Category.Name
lstCategories.DataSource = Categories
lstCategories.DisplayMember = "Name"
lstCategories.ValueMember = "ID"
After the user checks some items, I want to take the checked items, and perform a new Linq statement like this:-
Dim MatchedProducts = From Product In _DB.Products _
Where Product.CategoryID = lstCategories.CheckedItems.ID
However, Product.CategoryID is an integer, and lstCategories.CheckedItems
I believe I have to convert lstCategories.CheckedItems
Can anyone help?
Thanks
Dan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.