我的代码有这个小问题只是创建/显示最后一个表格单元。我知道它可能很小,但无法弄清楚我做错了什么。下面是我的代码。
Dim tbl As Table = New Table()
tblrow = New TableRow
tblcell = New TableHeaderCell
tblcell.Text = zone_name
tblcell.HorizontalAlign = HorizontalAlign.Center
tblrow.Cells.Add(tblcell)
tbl.Rows.Add(tblrow)
tblrow = New TableRow
tblcell = New TableCell
lblDesc = New Label
lblDesc.ID = "lbl_" & zone_name
lblDesc.Text = randomNum
tblcell.HorizontalAlign = HorizontalAlign.Center
tblcell.Controls.Add(lblDesc)
tblrow.Cells.Add(tblcell)
tbl.Rows.Add(tblrow)
** * ** * *编辑* ** * ** * ** * ***
公共函数 add_table(ByVal zone_name As String, ByVal hgt As Integer, ByVal randomNum As Integer, ByVal fontSize As Integer)
Dim tbl As Table = New Table()
tbl.ID = "tbl_" & zone_name
tblrow = New TableRow
tblcell = New TableCell
tblcell.Text = zone_name
tblcell.HorizontalAlign = HorizontalAlign.Center
tblrow.Cells.Add(tblcell)
tbl.Rows.Add(tblrow)
tblrow = New TableRow
tblcell = New TableCell
lblDesc = New Label
lblDesc.ID = "lbl_" & zone_name
lblDesc.Text = randomNum
tblcell.HorizontalAlign = HorizontalAlign.Center
tblcell.Controls.Add(lblDesc)
tblrow.Cells.Add(tblcell)
tbl.Rows.Add(tblrow)
Return tbl
End Function
tblrow = New TableHeaderRow
tblcell = New TableHeaderCell
tblcell.Controls.Add(add_table(zone_name, hgt, randomNum, fontSize))
tblSeatMap.Rows.Add(tblrow)