NestingQuery

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();

你可能感兴趣的:(query)