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 =
    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. Advertisements

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 (here). After that, you can post your question and our members will help you out.