LoadControl problem for 3.5

Discussion in 'ASP .Net Building Controls' started by SushiSean, Oct 24, 2008.

  1. SushiSean

    SushiSean Guest

    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?
     
    SushiSean, Oct 24, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmV4VmFu?=

    LoadControl() problem

    =?Utf-8?B?UmV4VmFu?=, Aug 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,274
    Stefan
    Aug 31, 2004
  2. =?Utf-8?B?U3VzaGlTZWFu?=

    LoadControl Compilation problem

    =?Utf-8?B?U3VzaGlTZWFu?=, Mar 6, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    380
    =?Utf-8?B?U3VzaGlTZWFu?=
    Mar 6, 2007
  3. jack
    Replies:
    2
    Views:
    571
  4. lennart
    Replies:
    1
    Views:
    474
    lennart
    Apr 25, 2010
  5. SushiSean

    LoadControl comilation problem.

    SushiSean, Mar 5, 2007, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    117
    SushiSean
    Mar 5, 2007
Loading...

Share This Page