LoadControl problem for 3.5

S

SushiSean

The problem is we have to move from framework 2 to 3.5 version
and some code start give me an error.
//framework 2 (works correct)
LayoutParts_SessionWork pWork =
this.LoadControl("~/LayoutParts/SessionWork.ascx") as LayoutParts_SessionWork;

pWork get class and works fine, but in 3.5 version thee same code give me
an error because pWork is NULL.
I have tried other way of convertion object to class
LayoutParts_SessionWork pWork =
(LayoutParts_SessionWork)this.LoadControl("~/LayoutParts/SessionWork.ascx");
and it works correct on both.

The question: why "object as [class name]" stop working? I need to do tons
of work because of it. Can somebody told me what is wrong?
 

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
474,056
Messages
2,570,443
Members
47,089
Latest member
Bobby2025b

Latest Threads

Top