473,799 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

questions about Controls.add

Bob
Hi,

In aspx file, i have a table:
<asp:Table ID="table1" runat="server">
</asp:Table>

In the code-behind, i create rows and cells:
For i = 0 To 50
r = New TableRow()
for j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i , j))
Next
Table1.Rows.Add (r)
Next
....

With this, the table is rendered perfectly (data are displayed in all rows
and cells).

Now i added this line just after 'r.Cells.Add(c( i, j))':
Controls.Add(c( i, j))

Now i have no table anymore: data are dispayed the one after the other in
the page.

My questions are:
1) where is my table, why is is gone?
2) what's the difference between 'Controls.Add(c (i,j))' and
r.Cells.Add(c(i , j)) in this case?

Thanks for help
Bob
Jun 16 '06 #1
2 1088
In one case you are adding row and cell objects to a table. So it
appropriately renders them

In the other case you are adding them to the page - not to the table. So
the page ends up with these objects, which it just renders in the order they
were added. Unlike the table which actually knows how to deal with these,
the page just sort of throws them on one after the other.

It's the difference between adding an object to a Panel you have on your
page, or to the page itself. They are different containers for your objects.

"Bob" <sd*@sdvsd.dc > wrote in message
news:OP******** ******@TK2MSFTN GP04.phx.gbl...
Hi,

In aspx file, i have a table:
<asp:Table ID="table1" runat="server">
</asp:Table>

In the code-behind, i create rows and cells:
For i = 0 To 50
r = New TableRow()
for j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i , j))
Next
Table1.Rows.Add (r)
Next
...

With this, the table is rendered perfectly (data are displayed in all rows
and cells).

Now i added this line just after 'r.Cells.Add(c( i, j))':
Controls.Add(c( i, j))

Now i have no table anymore: data are dispayed the one after the other in
the page.

My questions are:
1) where is my table, why is is gone?
2) what's the difference between 'Controls.Add(c (i,j))' and
r.Cells.Add(c(i , j)) in this case?

Thanks for help
Bob

Jun 16 '06 #2
Bob
Thanks for your explanation.
I have just sent another problem, related with this, but first i had to know
this answer.
"Marina Levit [MVP]" <so*****@nospam .com> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
In one case you are adding row and cell objects to a table. So it
appropriately renders them

In the other case you are adding them to the page - not to the table. So
the page ends up with these objects, which it just renders in the order they were added. Unlike the table which actually knows how to deal with these,
the page just sort of throws them on one after the other.

It's the difference between adding an object to a Panel you have on your
page, or to the page itself. They are different containers for your objects.
"Bob" <sd*@sdvsd.dc > wrote in message
news:OP******** ******@TK2MSFTN GP04.phx.gbl...
Hi,

In aspx file, i have a table:
<asp:Table ID="table1" runat="server">
</asp:Table>

In the code-behind, i create rows and cells:
For i = 0 To 50
r = New TableRow()
for j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i , j))
Next
Table1.Rows.Add (r)
Next
...

With this, the table is rendered perfectly (data are displayed in all rows and cells).

Now i added this line just after 'r.Cells.Add(c( i, j))':
Controls.Add(c( i, j))

Now i have no table anymore: data are dispayed the one after the other in the page.

My questions are:
1) where is my table, why is is gone?
2) what's the difference between 'Controls.Add(c (i,j))' and
r.Cells.Add(c(i , j)) in this case?

Thanks for help
Bob


Jun 16 '06 #3

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

Similar topics

3
3991
by: Tom Bean | last post by:
I am using Dotfuscator Community Edition to obfuscate an application for Pocket PC written in C#. When I made the first pass with Dotfuscator, the app threw a MissingManifestResourceException. Of course, since the app has been obfuscated, the only information I got about what caused the error pointed to resource aq. The Dotfuscator listing window had WARNINGs about all the forms in my app, so I excluded them on the 'Rename' tab and...
0
2075
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the data into a comboBox. One thing I noticed, however, is that this method shows me both the parameters used by the main report and parameters used by the sub-report(s).
10
2287
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
1
1711
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? Application is across all sessions. Session is across all pages. ViewState is sort of like Session, but for only one page. <-- Correct statement? Session is stored between page requests, somewhere in mem or IIS files --
1
1321
by: TBK | last post by:
I'm trying to finish up an assignment I had for a class and basically I'm stuck. The program is supposed to take information you've entered, put it into an array, display it in a listbox and then average the total of numbers. Right now I have 2 questions. How do I get numbers from my array that are put into the listbox into the 2 decimal format. I've tried all sorts of combinations and I can't get it to work. Second, I need to take the...
14
4975
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
6
1621
by: Kevin | last post by:
I come up with these questions during the day, do some research, and then look for experienced users' input. 1. In Access, we already know it's pretty much an automatic save if you enter data. How can I prevent that? How can I make an effective way in Access to not commit a change until a 'Save' button is pressed, and also to backout changes using a 'Cancel' button? 2. Let's say I have 15 objects on a form, and they're locked. I have...
13
12818
by: M.Siler | last post by:
Let me clarify from my last post. I am not using these 4 questions as the sole screening method. Currently in, the Tampa Bay area (Florida) there is an extreme shortage of C# developers. We have utilized just about every method known to man to find candidates, including employment firms (which I do not like to use, but when you're back in against the proverbial wall). With the employment firms they will send over just about anyone. So after...
2
1360
by: Seguros Catatumbo | last post by:
Hi, i have decent experience with asp 3.0 (classic), and downloaded web developer express to see what's the fuzz over it. I have lots of questions, mostly regarding the use of forms and database use. 1) Why should i use the asp:label, asp:textbox, asp:submit instead of plain old html input type="...", form action="..." 2) What's up with all those javascript:__dopostback links when using some controls? Does it mean text browsers and...
2
5577
by: Rune Jacobsen | last post by:
Hi all, I have a few questions on deriving from ScrollableControl that I hope will be relatively easy to answer. I am using Visual Studio 2003, C# and ..Net 1.1. I have this custom control I am making called ResourceView. It is supposed to show a visual overview of resource usage over time. Time is represented by the X axis, and the different resources (people, equipment, rooms etc.) are in the Y axis. Usually one will view a
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.