Accessing ascx file from windows desktop application

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top