【发布时间】:2010-10-20 14:22:54
【问题描述】:
我有一个通过 LINQ 表达式填充的 GridView。
像这样的:
GridView1.DataSource = from c in customers, o in c.Orders,
total = o.Total where total >= 2000 select new {id = c.CustomerID,
order = o.OrderID, total = total};
在它的 RowCreated 方法中,我尝试获取一个属性,例如 id,但它没有已知类型:
object element = e.Row.DataItem;
int id = element.id; // It's bad!!!!!!
我该怎么办?
谢谢!!
【问题讨论】: