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' 中,我想遍历它们并将其绑定到标签 'comment' 但每次循环绕过它都会重写前一个
<asp:Label ID="comment" runat="server" />
每次循环时我能做什么,它会在前一个标签下方添加一个新标签(将显示在屏幕上) - 而不是使用相同的标签......谢谢
感谢大家的回复..所有很好的帮助...虽然尝试在表格的单独行中显示每条记录有点问题
<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>
在一个单元格中显示所有结果...有什么想法吗?