473,395 Members | 1,869 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,395 software developers and data experts.

Which ASP.NET Controls Have Child Controls?

poi


In VS.NET 2003, I get intellisense if I do this:

LiteralControl literalControl = new LiteralControl();
literalControl.ID = "something";

literalControl.Controls.Add.....

And it compiles fine but I get an error saying that the LiteralControl
does not allow child controls.

So which controls *do* allow children, since VS.NET is not helping me?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
3 6334
The problem is, LiteralControl inherits from a class that has a Controls
property - so LiteralControl inherits it as well.

Container controls such as a Panel, PlaceHolder, and others have a Controls
collection you an manipulate.

Controls such as TextBox, Button, etc don't - and this just makes sense. A
button cannot have any controls within it - it is a button!

You just have to think about whether or not it really makes sense for a
control to have child controls.

"poi" <dd*****@rucs.nul> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...


In VS.NET 2003, I get intellisense if I do this:

LiteralControl literalControl = new LiteralControl();
literalControl.ID = "something";

literalControl.Controls.Add.....

And it compiles fine but I get an error saying that the LiteralControl
does not allow child controls.

So which controls *do* allow children, since VS.NET is not helping me?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
That's a darned good question. I am just guessing here, but I would suspect
that any control which renders a tag can have Controls added to it. The
reason I believe this is that adding a Control to the Controls Collection of
a Server Control appends the child Control HTML in between the starting and
ending tags of the parent Control. A LiteralControl can be plain text,
without any tag at all. I suspect that this is why you can't add Controls to
its' Controls Collection. I would love to hear an authoritative answer to
this question, though.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"poi" <dd*****@rucs.nul> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...


In VS.NET 2003, I get intellisense if I do this:

LiteralControl literalControl = new LiteralControl();
literalControl.ID = "something";

literalControl.Controls.Add.....

And it compiles fine but I get an error saying that the LiteralControl
does not allow child controls.

So which controls *do* allow children, since VS.NET is not helping me?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #3
And a good case in point... don't always rely on the grossly overrated
Intellisense.. ;)

Bill P.

On Fri, 01 Aug 2003 09:24:52 -0700, poi <dd*****@rucs.nul> wrote:


In VS.NET 2003, I get intellisense if I do this:

LiteralControl literalControl = new LiteralControl();
literalControl.ID = "something";

literalControl.Controls.Add.....

And it compiles fine but I get an error saying that the LiteralControl
does not allow child controls.

So which controls *do* allow children, since VS.NET is not helping me?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 17 '05 #4

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

Similar topics

2
by: Brindley | last post by:
Hi there, In my Mdi application, I have placed a set of controls on the parent form to call child forms. The problem is that the controls hide the child forms. I have used SendToBack when Im...
2
by: Terrance | last post by:
I'm hoping that there's someone out here that can help me with a coding problem. Here is the scenerio: I have a MdiParent Form on this MdiParent form there is a listview control and several text...
4
by: John Tyce | last post by:
The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates...
3
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it...
10
by: dx | last post by:
I have the Microsoft Press: Developing Microsoft ASP.NET Server Controls and Components book. It's starting to shine some light on control development but there is something about composite...
2
by: Juan Romero | last post by:
Hey guys, I am working on a web custom control that basically draws a table (ASP Table) with a few child controls in the cells. I have a command button inside one of these cells. The problem I...
9
by: antonyliu2002 | last post by:
I want to create session objects for all web controls in a page. Right now, I am doing it in a dumb way like this (for example): Session("Session1") = ctrl1.Text Session("Session2") =...
2
by: JohnR | last post by:
Let's say I have an MDI parent form with a textbox. If I create an MDI child form and, at runtime, move the MDI child window over the textbox on the MDI parent, the textbox appears in front of the...
3
by: Mike Collins | last post by:
I have some controls that I am creating dynamically. After the user finishes entering their answers in these controls, I would like to iterate through these controls and get the answers out. I have...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
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...

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.