I want to to create a table with 2 colums in a row. Then in the next row I want only 1 colum. Here is a part of my code:
writer.WriteBeginTag("table");
writer.Write(HtmlTextWriter.TagRightChar);
//first row
writer.WriteFullBeginTag("tr");
writer.WriteBeginTag("td");
writer.WriteAttribute("valign", "top");
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write("row 1, column 1");
writer.WriteEndTag("td");
writer.WriteBeginTag("td");
writer.WriteAttribute("valign", "top");
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write("row 1, column 2");
writer.WriteEndTag("td");
writer.WriteEndTag("tr");
//second row
writer.WriteFullBeginTag("tr");
writer.WriteBeginTag("td");
writer.WriteAttribute("valign", "top");
writer.WriteAttribute("colspan", "2");
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write("row 2, 1 column");
writer.WriteEndTag("td");
writer.WriteEndTag("tr");
writer.WriteEndTag("table");
Problem is dat the second row is rendered in 1 column, not in 2 columns. This is the outputted html
<tr>
<td valign="top">Check-out date</td>
<td valign="top">Sunday, March 18, 2012</td>
</tr>
<tr>
<td valign="top">You have indicated .... and badge.</td>
</tr>
I guess this is wrong:
writer.WriteAttribute("colspan", "2");
Does somebody know a solution?