HTML Table

asp.net html 控件 

html table

<script  runat="server">
sub submit(sender as object, e as eventargs)
dim row,numrows,numcells,j,i
row=0
numrows=cint(rows1.value)
numcells=cint(cells1.value)
for j=1 to numrows
   dim r as new htmltablerow()
   row=row+1
   for i=1 to numcells
     dim c as new htmltablecell()
     c.controls.add(new literalcontrol("row " & j & ", cell " & i))
     r.cells.add(c)
   next
   t1.rows.add(r)
   t1.visible=true
next
end sub 
</script>


<!doctype html>
<html>
<body> 

<form runat="server">
<p>table rows:
<select id="rows1" runat="server">
   <option value="1">1</option>
   <option value="2">2</option>
   <option value="3">3</option>
</select>
<br>table cells: 
<select id="cells1" runat="server">
   <option value="1">1</option>
   <option value="2">2</option>
   <option value="3">3</option>
</select>
<br><br>
<input type="submit" value="display table" runat="server" onserverclick="submit">
</p>
<table id="t1" border="1" runat="server" visible="false"/>
</form>

</body>
</html>
相关文章