更新时间:2023-01-21 22:48:13
您应该能够从您的查询直接绑定到您的网格:
you should be able to bind to your grid straight from your query:
`变种的用户= eFactory.SYMPOSIUM_Users.Where(A => a.UserID == eval.UserID.Value&放大器;&安培; a.Active.Value和放大器;&安培; a.UserRole == 1);
this.mygrid.DataSource =用户;
`var users = eFactory.SYMPOSIUM_Users.Where(a => a.UserID == eval.UserID.Value && a.Active.Value && a.UserRole == 1); this.mygrid.DataSource = users;
我会建议采取一看 asp.net网站网站的教程。很多很好的内容在那里。
I would suggest taking a look at the asp.net web site for tutorials. Lots of good content out there.
更新:结果
也许你的***的办法就是在你的两个表创建一个加入一个匿名类型,这样您不必重复查询您的数据存储和数据绑定你会简单一些。
Update:
Perhaps your best solution is to create an anonymous type from a join on your two tables, this way your not repeatedly querying your data store, and your databinding will be simpler.
var result = (from i in eFactory.Symposium_Evaluation
join user in eFactory.SYMPOSIUM_Users on i.UserID equals user.UserID
where user.UserRole == 1 &&
((!i.Completed.HasValue ||
i.Completed.Value == 0) &&
i.Active && a.UserID >= 2063)
select new {
User = user,
Symposium = i
}).ToList();
myDataGrid.DataSource = result;
myDataGrid.DataBind();
现在网格中的行模板,您可以:
Now in your grid row template you can:
<%#Eval("User.FirstName")%>
<%#Eval("User.LastName")%>
<%#Eval("User.Email")%>