<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>


<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>