Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!
It's just a matter of enhancing yourstringBuilderto include the HTML for a table, for example like this
ASP.net:stringBuilder.Append("<table>"); foreach (DataRow row in dt2.Rows) { stringBuilder.Append("<tr>") stringBuilder.Append("<td>Client Ref: ").Append(row["client_ref"]).Append("</td>"); stringBuilder.Append("<td>Crosk Ref: ").Append(row["crosk_ref"]).Append("</td>"); stringBuilder.Append("<td>Client Name: ").Append(row["client_name"]).Append("</td>"); stringBuilder.Append("<td>Section Name: ").Append(row["section_name"]).Append("</td>"); stringBuilder.Append("</tr>") } stringBuilder.Append("</table>");
(I haven't tested this code, but I think...
if (dt2.Rows.Count > 0)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (DataRow row in dt2.Rows)
{
stringBuilder.Append("Client Ref: ").Append(row["client_ref"]).Append("<br/>");
stringBuilder.Append("Crosk Ref: ").Append(row["crosk_ref"]).Append("<br/>");
stringBuilder.Append("Client Name: ").Append(row["client_name"]).Append("<br/>");
stringBuilder.Append("Section Name: ").Append(row["section_name"]).Append("<br/><br/>");
}
CLIENTREF.Text = stringBuilder.ToString();
}
else
{
CLIENTREF.Text = "No records found!";
}
stringBuilder to include the HTML for a table, for example like this stringBuilder.Append("<table>");
foreach (DataRow row in dt2.Rows)
{
stringBuilder.Append("<tr>")
stringBuilder.Append("<td>Client Ref: ").Append(row["client_ref"]).Append("</td>");
stringBuilder.Append("<td>Crosk Ref: ").Append(row["crosk_ref"]).Append("</td>");
stringBuilder.Append("<td>Client Name: ").Append(row["client_name"]).Append("</td>");
stringBuilder.Append("<td>Section Name: ").Append(row["section_name"]).Append("</td>");
stringBuilder.Append("</tr>")
}
stringBuilder.Append("</table>");
Beautiful!! thats just what i needed. thank youIt's just a matter of enhancing yourstringBuilderto include the HTML for a table, for example like this
ASP.net:stringBuilder.Append("<table>"); foreach (DataRow row in dt2.Rows) { stringBuilder.Append("<tr>") stringBuilder.Append("<td>Client Ref: ").Append(row["client_ref"]).Append("</td>"); stringBuilder.Append("<td>Crosk Ref: ").Append(row["crosk_ref"]).Append("</td>"); stringBuilder.Append("<td>Client Name: ").Append(row["client_name"]).Append("</td>"); stringBuilder.Append("<td>Section Name: ").Append(row["section_name"]).Append("</td>"); stringBuilder.Append("</tr>") } stringBuilder.Append("</table>");
(I haven't tested this code, but I think it should be ok)
No problem. If my code helped you out, don't forget to mark my post as the Solution.Beautiful!! thats just what i needed. thank you
Code Forum is a community platform where coding enthusiasts can connect with other developers, engage in discussions, ask for help, and share their knowledge with a supportive community. It's a perfect place to improve your coding skills and to find a community of like-minded individuals who share your passion for coding.
We use essential cookies to make this site work, and optional cookies to enhance your experience.