Dropdownlist does not allow child controls
I got an interesting error today, but first some background. I am creating a server control that inherits from DropDownList and internally I also add an image server control next to it. I add this image dynamically by trying to add it to the controls collection of the dropdownlist. When I try to do this I get an error saying that you cannot add controls to the dropdownlist controls collection.
When I look at the dropdownlist in reflector I noticed that the CreateControlsCollection has been overridden and an emptycontrolcollection is created. What this emptycontrolcollection does is enforce the rule that you cannot add controls to the control collection.
Now, I was able to override the CreateControlsCollection for my control, but I am curious as to why they did this. Does anyone know why? Its strange because I did this same functionality with a textbox and had no problems.