Adding checkbox to table

J

James

Hello,
I am a novice with c# and have a small problem. When I try to add a
checkbox into a table dynamically from within a c# program. I get a
message that it "must be placed inside a form tag with runat=server"
even though the table is set that way in the corresponding aspx file.
Any idea what's going on here? Here are the relevant parts of the
code:

Example.aspx:
<div style="OVERFLOW: auto; TEXT-ALIGN: center">Employee Tasks By Day
Schedule<br>
<div style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; OVERFLOW:
auto; BORDER-LEFT: 1px solid; WIDTH: 100%; BORDER-BOTTOM: 1px solid;
HEIGHT: 100px">
<asp:table id="Table2" runat="server" BorderWidth="2"
BorderStyle="Solid" HorizontalAlign="Left" Width="100%"
GridLines="Both" CellSpacing="2" CellPadding="2">
</asp:table>
</div>
</div>
-----------------------------------
Example.cs:
TableRow Row2 = new TableRow();
TableCell Cell1 = new TableCell();
CheckBox Check1 = new CheckBox();

Cell1.Controls.Add(Check1);
Row2.Cells.Add(Cell1);
Table2.Rows.Add(Row2);
 
G

Guest

There is no form tag in your source. If this is your enitre aspx then you
need to wrap it in:

<form id="form1" runat="server">
....
</form>

Ciaran O'Donnell
 

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

Top