This is my code:
IQueryable<Car> list = new List<Car>().AsQueryable<Car>();
foreach (TreeNode node in DataHierarchyTree.CheckedNodes)
{
var a = from c in ContextDB.Cars
where c.CarID == Int32.Parse(node.Value)
select c;
list.Union(a.ToList());
}
CarGridView.DataSource = list;
CarGridView.DataBind();
This renders nothing. I have run it through with stop points and it iterates 5 times. If I inspect the a
value there is a SELECT statement generated which produces plenty of rows in the result set when used with the values in the checked nodes list.
The problem is that no matter how many results are produced when I step the through code, the list
is always empty.
Why is this and what should I do to get the list of cars I'm looking for?