I'm trying to add rows to a table on page load instead of building the whole table in the designer. However, the following code produces no results. No error, just nothing on the screen. I'm defining the table in the html as follows:
<asp:Table id="Table1" BorderWidth="1" GridLines="Both" runat="server" />
then in the codebehind:
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim rows, cells, j, i
rows = 3
cells = 2
For j = 0 To rows - 1
Dim r As New TableRow()
For i = 0 To cells - 1
Dim c As New TableCell()
c.Controls.Add(New LiteralControl("row " & j & ", cell " & i))
r.Cells.Add(c)
Next
Table1.Rows.Add(r)
Next
End Sub
I'm a complete noob to .NET. Any help would be appreciated.
<asp:Table id="Table1" BorderWidth="1" GridLines="Both" runat="server" />
then in the codebehind:
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim rows, cells, j, i
rows = 3
cells = 2
For j = 0 To rows - 1
Dim r As New TableRow()
For i = 0 To cells - 1
Dim c As New TableCell()
c.Controls.Add(New LiteralControl("row " & j & ", cell " & i))
r.Cells.Add(c)
Next
Table1.Rows.Add(r)
Next
End Sub
I'm a complete noob to .NET. Any help would be appreciated.