If you
System.Web.UI.WebControls.Image Image2;
Image2 = new System.Web.UI.WebControls.Image();
this.Controls.Add(Image2);
Image2.ID="hei";
System.Web.UI.WebControls.Image Image1;
Image1 = new System.Web.UI.WebControls.Image();
this.Controls.Add(Image1);
Image1.ID = "Im1";
In
page load then they do show up.
It's the "new" keyword that does it.
When you use the designer you are in design time so they won't show up, in
effect the "new" bit added to them at runtime if you use the designer.
foreach(Control cn in Page.Controls )
{
Response.Write("Controls " + cn.GetType().ToString() + "<br>");
}
or
IEnumerator myEnumerator = Page.Controls.GetEnumerator();
while ( myEnumerator.MoveNext() )
Response.Write(myEnumerator.Current.GetType().ToString() + "<br>");
I know what you've done ... you say Literals show up. They don't. asp.NET, with
a blank page, comes up with 3 of them.
System.Web.UI.ResourceBasedLiteralControl
System.Web.UI.HtmlControls.HtmlForm
System.Web.UI.LiteralControl
The form, the literal control is viewstate what is the other ? The other,
believe it or not is the <html></html> tag
Nothing you add from toolbox will show here .... you must add them
programmatically to show up.
I know what you did, you added a literal from the toolbox and then an Image and
then you had the 3 above coming up ... you assumed (after deleting the Image)
that the literal DID show up.
Don't take this as a expert talking, but its about right - it's the "new"
keyword that is what it's AAAAALL about. Bear that in mind, it comes up around
the place and is very important.