Dynamically creating checkbox on my asp page

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

HI
I have a asp page which dynamically creates a table with 28 rows, 3 columns.
Column 1 contains a label, column 2 contains a graphic, column 3 needs to
contain a checkbox.

I have no problems with column 1 & 2, but column 3 gives me this error :-
Control 'CHECKBOX1' of type 'CheckBox' must be placed inside a form tag with
runat=server.

Any ideas?
Paul

Snippet of my code.

subcell = New WebControls.TableCell
checkbox = New WebControls.CheckBox

checkbox.EnableViewState = True

checkbox.ID = "CHECKBOX" & loopy

subcell.Controls.Add(checkbox)

subrow.Cells.Add(subcell)
 
hi,
make sure that the table to which you are adding the cells is
insice the form tags with runat attribute set to server.

example:

<form runat=server>
<asp:Table id="Table1" runat="server"></asp:Table>
</form>

table1 is the table to which you are adding the cells.
 
Back
Top