Instantiate UserControl without LoadControl

Discussion in 'ASP .Net' started by Matteo Migliore, Jun 7, 2005.

  1. Hi.

    This is a question about ASP.NET 2.0.

    How can I instantiate a UserControl without
    the method LoadControl?

    I need to create a usercontrol from
    a .ascx file that is out of the web application,
    it's placed into a virtual directory.

    Thanks!

    Matteo Migliore.
     
    Matteo Migliore, Jun 7, 2005
    #1
    1. Advertising

  2. In the ASP.NET model, user controls are the down and dirty way to get
    repetitive functionality without complete black boxing your code. It is a
    compromise between flexibility and full encapsulation. Because of the
    compromise, you are stuck in a tigher box than you are with compiled code.

    I can think of a possible kludge and fix for this issue:

    The kludge is to aim at the source file and reflect emit in your
    application. Have not tried with a user control, but it "should" work with
    some tweaking.

    The fix is to move your code to a library as a server control. This will
    take more time.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "Matteo Migliore" wrote:

    > Hi.
    >
    > This is a question about ASP.NET 2.0.
    >
    > How can I instantiate a UserControl without
    > the method LoadControl?
    >
    > I need to create a usercontrol from
    > a .ascx file that is out of the web application,
    > it's placed into a virtual directory.
    >
    > Thanks!
    >
    > Matteo Migliore.
    >
    >
    >
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Jun 7, 2005
    #2
    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. huobazi
    Replies:
    1
    Views:
    742
    David Waz...
    Jul 3, 2003
  2. Sascha
    Replies:
    4
    Views:
    13,092
    thenongt
    Mar 12, 2008
  3. Fei Liu
    Replies:
    0
    Views:
    442
    Fei Liu
    Oct 25, 2007
  4. Fei Liu
    Replies:
    4
    Views:
    821
    Victor Bazarov
    Oct 26, 2007
  5. Reik
    Replies:
    1
    Views:
    258
    Brock Allen
    Apr 12, 2005
Loading...

Share This Page