G
Guest
Hello
I am trying to write a #C windows desktop application that loads an ascx file contents (user control) from file, initiates it and then registers to database everything it finds. I tried that way:
1 Page page=new Page();
2 Control control=page.LoadControl(virtualPath);
3 string debug = control.ID;
but I got NullReferenceException on the 2nd line.
From earlier post http://www.dotnet247.com/247reference/msgs/29/148858.aspx
I found out that to create a control dynamically, one first needs to include className into the ascx and to register the control in page. My brand new dynamically created page object of course lacks that registration and I guess that's why the LoadControl method does not work.
Is anybody able to explain, how to properly look up the contents of an ascx file?
I would appreciate if you sent all answers directly to (e-mail address removed) as well.
Thanks in advance,
Kristjan
I am trying to write a #C windows desktop application that loads an ascx file contents (user control) from file, initiates it and then registers to database everything it finds. I tried that way:
1 Page page=new Page();
2 Control control=page.LoadControl(virtualPath);
3 string debug = control.ID;
but I got NullReferenceException on the 2nd line.
From earlier post http://www.dotnet247.com/247reference/msgs/29/148858.aspx
I found out that to create a control dynamically, one first needs to include className into the ascx and to register the control in page. My brand new dynamically created page object of course lacks that registration and I guess that's why the LoadControl method does not work.
Is anybody able to explain, how to properly look up the contents of an ascx file?
I would appreciate if you sent all answers directly to (e-mail address removed) as well.
Thanks in advance,
Kristjan