ChecklistRecordEntry =
(from CRE in db.Checklist_Record_Entries
where CRE.Check_List_Records_Id == checklistRecordId
select CRE).ToList();
foreach (Checklist_Record_Entry CRE in ChecklistRecordEntry)
{
comment.Text = CRE.Comment;
}
在2个记录存储在“ChecklistRecordEntry”在我想通过这些循环并将其绑定到标签“评论”但后来每次循环将围绕它改写较前一个结果传递标签
<asp:Label ID="comment" runat="server" />
我能在每次绕着环路它增加了前一个(将显示在屏幕上)下的新标签的时间这样做 - 而不是使用相同的标签.. .thanks
感谢您的答复everyone..all很好的帮助...一个问题有点想显示在表中单独的行内的每个记录虽然
<table class="detailstable FadeOutOnEdit">
<tr>
<th style="width:200px;"></th>
<th style="width:200px;">Item</th>
<th style="width:200px;"></th>
<th style="width:200px;"></th>
<th style="width:200px;"><asp:Label ID="CommentHeader" Text="Comment" /></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th style="width:200px;"><asp:Label ID="Comment" runat="server"/></th>
</tr>
</table>
显示结果所有内一个单元......任何想法?
感谢您的答复,怎么会我把它绑定在我的for循环中作为foreach(Checklist_Record_Entry CRE in ChecklistRecordEntry) { rptComments.DataBind = string.Join(“
”, ChecklistRecordEntry.Se lect(a => a.Comment)); } – John 2013-03-03 19:59:47
@John,更新了适合表范例的答案。 – 2013-03-03 20:05:28
非常好的工作非常感谢 – John 2013-03-03 20:08:11