I have a linq query,
var j=from o in Orders
join OT in OrderDetails on o.OrderId equals OT.OrderId
group OT.ProductId by o.OrderId into g
select new{OrderId=g.Key,ProductId=g};
j.Dump();
It returns the data as,
5IOrderedQueryable<> (4 items)4
OrderId ProductId
13 Key= 13
5IGrouping<Int32,Int32> (2 items)4
32
40
14 Key= 14
5IGrouping<Int32,Int32> (3 items)4
39
48
49
15 Key= 15
5IGrouping<Int32,Int32> (2 items)4
43
30
16 Key= 16
5IGrouping<Int32,Int32> (3 items)4
43
48
49
---
I binded this query to gridview as ,
var j = (from o in con.Orders
join OT in con.OrderDetails on o.OrderId equals OT.OrderId
group OT.ProductId by o.OrderId into g
select new { OrderId = g.Key, ProductId = g }).ToList();
gridview.DataSource = j;
gridview.DataBind();
like this, but whe i execute i got gridview displaying like this,
Order Id Product Id
13 System.Data.Entity.Core.Objects.ELinq.InitializerMetadata+Grouping`2[System.Int32,System.Int32]
14 System.Data.Entity.Core.Objects.ELinq.InitializerMetadata+Grouping`2[System.Int32,System.Int32]
15 System.Data.Entity.Core.Objects.ELinq.InitializerMetadata+Grouping`2[System.Int32,System.Int32]
16 System.Data.Entity.Core.Objects.ELinq.InitializerMetadata+Grouping`2[System.Int32,System.Int32]
how to make gridview to display like this i want,
OrderId ProductId
13 32
40
14 39
48
49
15 43
30
16 43
48
49
like this , pls help me