Last post Sep 27, 2010 05:45 PM by pbeisel
Jan 26, 2009 05:29 PM|lax4u|LINK
protected void Page_Load(object sender, EventArgs e)
// This is NOT working. I dont see user control on page
Type type = Type.GetType("TestProject.UserControls.Gender");
Control uc = Page.LoadControl(type,null);
//This is working. I can see user control on page
Control uc1 = Page.LoadControl("~/UserControls/Gender.ascx");
If i use OverLoaded method LoadControl(string VirtualPath) then it works fine.
Jan 26, 2009 07:33 PM|Rick Matthys|LINK
Maybe you didn't see my replay to your previous post at
http://forums.asp.net/t/1375955.aspx. If you didn't, here it is again:
This problem is noted on msdn: http://msdn.microsoft.com/en-us/library/ewtd66a0.aspx. Look near the bottom for the error.
A page that loads a user control using the Page.LoadControl(Type, Object) does not seem to create its children added in the ascx file.
Using Page.LoadControl(String) works as expected.
Hope this helps... ~Rick
Sep 27, 2010 05:45 PM|pbeisel|LINK
did you ever find a resolution to this problem?