Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Remove all the current rows and cells.
Table1.Controls.Clear()
Dim row, col As Integer
For row = 0 To 3
'Create a new TableRow object.
Dim rowNew As New TableRow
'Put the TableRow in the Table.
Table1.Controls.Add(rowNew)
For col = 0 To 3
'Create a new TableCell object.
Dim cellNew As New TableCell()
cellNew.Text = "Example Cell (" & row.ToString() & ","
cellNew.Text &= col.ToString() & ")"
cellNew.BorderStyle = BorderStyle.Double
cellNew.BorderWidth = Unit.Pixel(2)
'Put the TableCell in the TableRow.
rowNew.Controls.Add(cellNew)
Next col
Next row
End Sub