I have a DataTable that is populated from a stored procedure. I am making a query in a DataTable using groupby so that I can implement a ListView in a ListView. (Matt Berseth - Grouping with LinqDataSource and ListView ASP.NET 3.5 Controls )
My request in my code:
var query = from c in dtTaskOrder.AsEnumerable()
group c by c.Field<string>("CLIN") into g
select new
{
Key = g.Key,
Count = g.Count(),
Items = g
};
listv.DataSource = query.ToList();
listv.DataBind();
In my aspx file, I try Eval on elements and subsequent columns:
<asp:ListView ID="lv1" ... DataSource='<%# Eval("Items") %>'>
<td><%# Eval("SLIN") %></td>
<td><%# Eval("ACRN") %></td>
<td><%# Eval("Status") %></td>
The HttpException was not handled by the user code - when it tries to Eval by the names of the named columns.
How can I formulate the above query so that “Items” is “Typed” and I can use column names.
Thank you for your help.
Chrisb
source
share