我有一个RIA服务,即返回学校列表并填充数据网格。此数据网格在整个网格中复制第一个结果,而不是在其自己的行中显示源中的每个项目。
服务如下
var schools1 = (from i in DataContext.PrevSchools
join skl in DataContext.SchoolLists on i.School_id equals skl.School_Id
where i.Email_Address == email
select new PreviousSchools
{
PrevSchoolsId = i.PrevSchools_id,
AppEmail = i.Email_Address,
SchoolId = i.School_id,
DateAttended = i.YearsAttended,
Study = i.Study,
Credit = i.Credit,
CompleteStatus = i.Complete_Status,
Award = i.Award,
SchoolName = skl.School_name
}).Union(from i in DataContext.PrevSchools
join skl1 in DataContext.Schools on i.School_id equals skl1.School_id
where i.Email_Address == email && i.School_type_id == 1
select new PreviousSchools
{
PrevSchoolsId = i.PrevSchools_id,
AppEmail = i.Email_Address,
SchoolId = i.School_id,
DateAttended = i.YearsAttended,
Study = i.Study,
Credit = i.Credit,
CompleteStatus = i.Complete_Status,
Award = i.Award,
SchoolName = skl1.School_name
}).OrderBy(q => q.SchoolName);
return schools1;
数据绑定是:
this.PrevSchools.prevSchoolDataGrid.DataContext = SchoolsList;
SchoolList是一个ObservableCollection,它被设置为一个列表,也是一个IEnumerable,它仍然产生了重复的结果。
答案 0 :(得分:0)
修正了它,这是Model类中的一个错误,该键被设置为错误的属性