Dynamically Added User Control

Discussion in 'ASP .Net' started by Jenni.Haughton@googlemail.com, Jun 8, 2007.

  1. Guest

    I have a solution with 2 projects in it. I need to programatically
    add a user control from one project into the other one (as you cannot
    declare this normally on the form because it is in a different
    application). When the page_load event of the user control is fired at
    run-time, none of the form objects on the user control exist.

    Is this a namespace issue? Or can you just not share a user control
    over 2 projects without having a copy in both projects.

    Thanks,
    Jenni
     
    , Jun 8, 2007
    #1
    1. Advertising

  2. Lloyd Sheen Guest

    <> wrote in message
    news:...
    >I have a solution with 2 projects in it. I need to programatically
    > add a user control from one project into the other one (as you cannot
    > declare this normally on the form because it is in a different
    > application). When the page_load event of the user control is fired at
    > run-time, none of the form objects on the user control exist.
    >
    > Is this a namespace issue? Or can you just not share a user control
    > over 2 projects without having a copy in both projects.
    >
    > Thanks,
    > Jenni
    >


    This should be easy. I would create a third project for the usercontrol.
    Then from each of the other projects either reference the usercontrol
    assembly or the usercontrol project depending on the level of debugging you
    are doing. Then when the usercontrol has changes the other two projects
    will automatically pick up the new version (if you open the projects and
    build the project).

    Hope this helps,
    Lloyd Sheen
     
    Lloyd Sheen, Jun 8, 2007
    #2
    1. Advertising

  3. Guest

    Thanks for the post.
    The trouble is accessing the user control once it is in a seperate
    project. I can reference it ok, but at run-time the control within
    the user control do not exist.

    Thanks,
    Jen
     
    , Jun 8, 2007
    #3
  4. Lloyd Sheen Guest

    <> wrote in message
    news:...
    > Thanks for the post.
    > The trouble is accessing the user control once it is in a seperate
    > project. I can reference it ok, but at run-time the control within
    > the user control do not exist.
    >
    > Thanks,
    > Jen
    >

    Do you mean that you have multiple controls within your usercontrol?

    If so you must provide the method of accessing the controls. This can be
    done with functions or readonly properties.

    Hope this helps
    Lloyd Sheen
     
    Lloyd Sheen, Jun 8, 2007
    #4
    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. Bennett Haselton
    Replies:
    1
    Views:
    543
    John M Deal
    Nov 8, 2004
  2. Jon B
    Replies:
    5
    Views:
    5,260
  3. =?Utf-8?B?U2FtdWVs?=
    Replies:
    7
    Views:
    1,073
    Scott Allen
    Aug 10, 2005
  4. Replies:
    1
    Views:
    451
    Teemu Keiski
    Jan 3, 2006
  5. Chris

    Dynamically added user control

    Chris, Apr 1, 2007, in forum: ASP .Net
    Replies:
    9
    Views:
    632
    Mark Rae
    Apr 1, 2007
Loading...

Share This Page