Table

时间:2023-03-09 01:42:19
Table

Table tb = new Table();
TableRow r = new TableRow();

TableCell c = new TableCell();
c.Text = "Start";
r.Cells.Add(c);

tb.Rows.Add(r);

c.Controls   //声明一个控件实例,然后将其添加到单元格的 Controls 集合。

<table border="0" style="border-style:hidden;" cellspacing="0" cellpadding="5" >
             <%
                 foreach (TableRow tr in tb.Rows)
                 {
                 %>
                  <tr>
                   <%
                       foreach(TableCell ts in tr.Cells)
                       {        
                           %>                      
                            <td ><%=ts.Text%></td> 
                          <%
                        }
                        %>
                   </tr>
               <%
             }
              %>
            </table>