Makah
Makah

Reputation: 4513

Create asp:table inside an asp table

I want to do something like the code below using asp:table dynamically. I know how to use Table, TableRow and TableCell, but I don't know how I can add a Table inside a TableRow.

<table>
  <tr>    
  <td>[Image]</td>
<td>
<table>
  <tr>
    <td>Name</td>
    <td>Test</td>    
  </tr>
  <tr>
    <td>Month</td>
    <td>January</td>    
  </tr>
  <tr>
    <td>Code</td>
    <td>11100</td>    
  </tr>
  <tr>
    <td>Price</td>
    <td>$100,00</td>    
  </tr>
</table>
</td>
  </tr>
</table>

Upvotes: 0

Views: 2456

Answers (2)

myermian
myermian

Reputation: 32505

I want to do something like the code bellow using asp:table dynamically. I know how to use Table, TableRow and TableCell. But i don't know how can i add a Table inside a TableRow.

Might I suggest instead you create a single table where you take advantage of row spans instead? Basically you should have 3 columns and the first column has a row height of 4 whereas the 2nd and 3rd columns don't.

Upvotes: 1

KV Prajapati
KV Prajapati

Reputation: 94635

Try this,

string table = "<table><tr><td>foo</td></tr></table>";

TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Text = table;
row.Cells.Add(cell);
Table1.Rows.Add(row);

Upvotes: 1

Related Questions