Hello
I am trying to write a #C windows desktop application that loadsan ascx file contents (user control) from file, initiates it andthen registers to database everything it finds. I tried thatway:
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 posthttp://www.dotnet247.com/247reference/msgs/29/148858.aspx
I found out that to create a control dynamically, one first needsto include className into the ascx and to register the controlin page. My brand new dynamically created page object of courselacks that registration and I guess that's why the LoadControlmethod does not work.
Is anybody able to explain, how to properly look up the contentsof an ascx file?
I would appreciate if you sent all answers directly to***************@just.ee as well.
Thanks in advance,
Kristjan
--------------------------------
From: Kristjan Sander
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>xUkaIAn1MEaIrdi5SegYnA==</Id>