Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Declare UserControl in a class

Reply
Thread Tools

Declare UserControl in a class

 
 
Chris Zopers
Guest
Posts: n/a
 
      02-13-2008
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 ***
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      02-13-2008
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 ***
>

 
Reply With Quote
 
 
 
 
gnewsgroup
Guest
Posts: n/a
 
      02-13-2008
On Feb 13, 2:40*pm, bruce barker
<(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web usercontrol + delegates or specialised usercontrol base class info@record-play.com ASP .Net 0 06-23-2006 09:41 AM
what are the other ways to prevent a class from being subclassed. one way is to declare the class final. srinivas.veeranki@gmail.com Java 20 02-17-2006 12:21 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
can I declare a class variable inside that class method? John Black C++ 2 06-15-2004 03:24 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi ASP .Net 1 07-03-2003 03:14 AM



Advertisments