A
alecyy
hi,
I create a UserControl called "RegInfo.ascx",
then i add a PlaceHolder to WebForm1,
and in WebForm1.Page_Load() i wrote the follow statement:
placeHolder.Controls.Add(new RegInfo());
but when i pressed F5 to run the web app, it shows nothing.
after search web to find out solution, i replaced upper statement with:
placeHolder.Controls.Add(Page.LoadControl("RegInfo.ascx"));
it work as my expect!
I am so confused about the two results,
Don't they add a new instance of RegInfo into the placeHolder?
Why one can work exactly while anthor don't?
I create a UserControl called "RegInfo.ascx",
then i add a PlaceHolder to WebForm1,
and in WebForm1.Page_Load() i wrote the follow statement:
placeHolder.Controls.Add(new RegInfo());
but when i pressed F5 to run the web app, it shows nothing.
after search web to find out solution, i replaced upper statement with:
placeHolder.Controls.Add(Page.LoadControl("RegInfo.ascx"));
it work as my expect!
I am so confused about the two results,
Don't they add a new instance of RegInfo into the placeHolder?
Why one can work exactly while anthor don't?