【发布时间】:2020-04-11 17:46:04
【问题描述】:
我正在遍历数据集和 pikcing 字段并将其放入我使用电子邮件发送的 html 表中。它有效,但只有第一行是正确的,但不是下一行。为什么?
Dim textBody As New StringBuilder
textBody.Append("<p> <b> Dear " & dsEmails.Tables(0).Rows(0).Item("FullName") & ",</b> <br /> <br /> Kindly review the timesheets of employees who have partially filled the records for week" + PreviousWeek.ToString() + "</b> <br /><br /> <br /></p>").AppendLine()
textBody.Append("<br><table rules='all' bordercolor='#4d4c4d' border='1' bgcolor='#FFFFFF' cellpadding='8' align='center' width='500'>
<tr>
<th>Employee</th>
<th>TotalHours</th>
<th>Week</th>
<th>Year</th>
</tr>
<tr>").AppendLine()
For Each row As DataRow In CTRData.Tables(0).Rows
textBody.Append("<td bgcolor='#da5903' style='height: 5px;' > " + row("Employee_Name").ToString() + "</td>").AppendLine()
textBody.Append("<td bgcolor='#da5903' style='height: 5px;'>" + row("OverallHrs").ToString() + " </td>").AppendLine()
textBody.Append("<td bgcolor='#da5903' style='height: 5px;' > " + row("Week").ToString() + " </td>").AppendLine()
textBody.Append("<td bgcolor='#da5903' style='height: 5px;'>" + row("Year").ToString() + " </td>").AppendLine()
textBody.Append("</tr></table>").AppendLine()
Next
【问题讨论】:
-
首先将第二个
<tr>放入 ForEach 循环中...现在它会生成无效的 html。
标签: html asp.net .net vb.net dataset