Within my ASP.net user control, I am dynamically generating an HTML table from the code behind. The initial structure is outlined below:
<table>
<tr>
<td>Property1</td>
<td>Property2</td>
<td>Property3</td>
<td>Property4</td>
</tr>
<tr>
<td>Value1</td>
<td>Value2</td>
<td>Value3</td>
<td>Value4</td>
</tr>
</table>
The challenge I face is that I need to rearrange the table based on the size of the container it will be placed in (since it's a user control). For example, if each cell has a width of 20px and the container's width is only 40px, the structure should look like this:
<table>
<tr>
<td>Property1</td>
<td>Property2</td>
</tr>
<tr>
<td>Value1</td>
<td>Value2</td>
</tr>
</table>
<table>
<tr>
<td>Property3</td>
<td>Property4</td>
</tr>
<tr>
<td>Value3</td>
<td>Value4</td>
</tr>
</table>