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