473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Adding checkbox to table

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

Sep 11 '06 #1
1 10841
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
"James" wrote:
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);

Sep 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mellie | last post by:
Hi there, SQL 2000 database with ASP I've found many things "out there" regarding updating and deleting multiple records with checkboxes but I can't seem to find anything about adding them. ...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
1
by: srneu71 | last post by:
I have a project that requires a dynamically generated matrix table. The table is setup with 4 quadrants (N,S,E,W) with checkboxes to "link" the data in adjacent quadrants. The table has to be...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
4
by: ballygowanboy | last post by:
i've put this code together. there's a variable "s" giving me some grief at the mo, i'm actualy supprised it half works. it's a simple shopping cart, you pick the quantitly of items, and it...
5
by: Sansasoon | last post by:
Hi there, I am supposed to do a shop ... which I ve done so far. The only thing that I can't get working is adding up to get the result It would be really great if someone could help me (Sorry it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.