'How to add a new line from a for loop variable in a <td> cell
I have the following line of code, that is creating a "td" Tag as it loop in my foreach clause.
foreach (var documenttitle in title)
{
_row += "<td valign=\"top\">" + documenttitle + "</td>";
}
My problem is that I need to have a TD tag created at first but I don't want this td to repeat itself as it loop through my documenttitle. So all documenttitle should be in one TD.
Below is what I am getting and what I am expecting.
What I'm getting: Table: Column A ColumnB DocumentTitle DocumentTitle (ALL in one line)
What I'm expecting:
DocumentTitle
DocumentTitle
Solution 1:[1]
My problem is that I need to have a TD tag created at first but I don't want this td to repeat itself as it loop through my documenttitle. So all documenttitle should be in one TD
Jiggle the order of your code round to match what you're saying ..
_row += "<td valign=\"top\">";
foreach (var documenttitle in title)
{
_row += documenttitle;
}
_row += "<td valign=\"top\">";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Caius Jard |
