0

这是我的桌子:

<asp:Table ID="Table1" runat="server">
    <asp:TableRow>
        <asp:TableCell>number</asp:TableCell>
        <asp:TableCell ID="webCell"></asp:TableCell>
    </asp:TableRow>
</asp:Table>

这是我的服务器端代码:

For i = 0 To IDsList.Length - 1
    Dim chk As CheckBox = New CheckBox()
    chk.ID = "webCatID" & Convert.ToString(i)
    chk.Text = Convert.ToString(CatsName(i))
    chk.BorderStyle = BorderStyle.None
    chk.CssClass = "checkBox"
    webCell.Controls.Add(chk) 'does not work, it does not webCell
Next

如何将这些复选框添加到该单元格?

4

1 回答 1

1

WebCellis not runat=server,所以你不能在代码隐藏中引用它,添加它:

<asp:TableCell ID="webCell" runat="server"></asp:TableCell>
于 2013-02-17T20:53:34.747 回答