Declare UserControl in a class

Discussion in 'ASP .Net' started by Chris Zopers, Feb 13, 2008.

  1. Chris Zopers

    Chris Zopers Guest

    Hello,

    I have a UserControl with the name Toolbox, so the UserControl's class
    name is UserControls_Toolbox.

    I want to pass this UserControl to a function in another (static) class,
    just as you would do with for example a string value:

    For example:
    string sValue = 'hello';
    OtherStaticClass.FunctionName(sValue);

    But the problem is that the UserControl's type is unkown in the static
    class, so I can't make a function that expects the UserControl as a
    parameter.

    How can I make something like this:

    public void FunctionName(UserControls_Toolbox tb)
    {
    }

    In an aspx page this is not a problem, because in an aspx page I can
    declare a variable of type UserControls_Toolbox, but in an other class
    this seems not to be possible. Anyone got an idea?

    Greetings,
    Chris




    *** Sent via Developersdex http://www.developersdex.com ***
    Chris Zopers, Feb 13, 2008
    #1
    1. Advertising

  2. Chris Zopers

    bruce barker Guest

    define an interface (in appcode) that the user control implements. then you
    can pass the interface to the static class

    -- bruce (sqlwork.com)


    "Chris Zopers" wrote:

    > Hello,
    >
    > I have a UserControl with the name Toolbox, so the UserControl's class
    > name is UserControls_Toolbox.
    >
    > I want to pass this UserControl to a function in another (static) class,
    > just as you would do with for example a string value:
    >
    > For example:
    > string sValue = 'hello';
    > OtherStaticClass.FunctionName(sValue);
    >
    > But the problem is that the UserControl's type is unkown in the static
    > class, so I can't make a function that expects the UserControl as a
    > parameter.
    >
    > How can I make something like this:
    >
    > public void FunctionName(UserControls_Toolbox tb)
    > {
    > }
    >
    > In an aspx page this is not a problem, because in an aspx page I can
    > declare a variable of type UserControls_Toolbox, but in an other class
    > this seems not to be possible. Anyone got an idea?
    >
    > Greetings,
    > Chris
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >
    bruce barker, Feb 13, 2008
    #2
    1. Advertising

  3. Chris Zopers

    gnewsgroup Guest

    On Feb 13, 2:40 pm, bruce barker
    <> wrote:
    > define an interface (in appcode) that the user control implements. then you
    > can pass the interface to the static class
    >
    > -- bruce (sqlwork.com)
    >


    I am jumping into the conversation. But, why can't we do this shown
    below?

    UserControls_Toolbox tb
    gnewsgroup, Feb 13, 2008
    #3
    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:
    667
    David Waz...
    Jul 3, 2003
  2. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    399
    Rajesh Tiwari
    Aug 12, 2003
  3. Replies:
    20
    Views:
    2,184
  4. John Black
    Replies:
    2
    Views:
    359
    jeffc
    Jun 15, 2004
  5. Replies:
    0
    Views:
    463
Loading...

Share This Page