Dynamically creating checkbox on my asp page

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)
 
V

vijay

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top