473,769 Members | 8,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6357
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.n ul> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.n ul> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.n ul> 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
3087
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 calling the child form, that works fine. The problem arrises when I want to show those controls again when I close the child form. Im sure BringToFront will work but im not sure how to do this from the child form.
2
1620
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 controls. This MdiParent form has a menu bar that gives the user the ability to open child forms. My problem is when the child form(s) are opend and if the user moves the child form over the listview contol or text controls the listview and text...
4
2348
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 in a combo box in my tool bar that are associated with the particular report that the user is opening. When the user picks a different date all of the data in the controls should reload. I originally built an SDI application but needed my tool bar to...
3
7730
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 calls the Parent controls CreateChildControls() method before calling the child control's button click event. Because of this behaviour, I am not getting the changes I made in the
10
2324
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 controls that I don't understand... I've included a snippet from Chapter 12 below on Composite Controls: <start> Override the CreateChildControls method to instantiate child controls, initialize them, and add them to the control tree. Do not perform...
2
2226
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 am running into is that I cannot get the click event of this object handled. I have tried wiring the event with "AddHandler" among other things and that seems not to work neither.
9
3335
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") = ctrl2.Text Session("Session3") = ctrl3.Text Session("Session4") = ctrl4.SelectedValue Session("Session5") = ctrl5.Text Session("Session6") = ctrl6.Text
2
14023
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 MDI child window. How can I make the MDI child window appear in front of any controls that may be on the MDI parent? thanks, John
3
1689
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 tried a couple of ways, but do not see those controls there. Can someone please help? Below is snippett of code to show how I am adding the controls and "for now" how I am trying to read them back. foreach(Question.BuildingBlock buildingBlock...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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,...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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
5310
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...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.