ASP.NET中的Repeater绑定 我希望嵌套的选择元素绑定到转发器。这是我的代码:
var ret = (from post in db.Posts.ToList()
orderby post.PostedDate descending
select new
{
Message = post.Message,
PostedBy = post.PostedBy,
PostedByName = post.UserProfile.UserName,
PostedDate = post.PostedDate,
PostId = post.PostId,
PostComments = from comment in post.PostComments.ToList()
orderby comment.CommentedDate
select new
{
CommentedBy = comment.CommentedBy,
CommentedByName = comment.UserProfile.UserName,
CommentedDate = comment.CommentedDate,
CommentId = comment.CommentId,
Message = comment.Message,
PostId = comment.PostId
}
}).AsEnumerable();
在aspx页面上我的帖子得到了绑定<%#Eval("PostedBy")%>
但是我想要在特定帖子发表评论,我无法绑定评论元素,如commentedby
,commentid
,commentdate
。
<%#Eval("CommentedBy")%>
但它并没有受到约束。
请帮我解决这个问题,如何将CommentedDate
和其他元素绑定到评论框布局?