DataClassesDataContext dc = new DataClassesDataContext();
var query = from type in dc.DictionaryType
select new
{
DictTypeName = type.DictTypeName,
ItemList = from item in dc.DictionaryItem
where item.DictTypeID == type.DictTypeID
select item
};
GridView1.DataSource = query;
GridView1.DataBind();
转载于:https://www.cnblogs.com/Yellowshorts/archive/2013/01/18/2866688.html