Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't reference my web user control in code :(

Status
Not open for further replies.

Smeat

Programmer
Mar 27, 2004
193
GB
Hi

I have a web application that contains a web user control in a sub directory.

App Root
--> Administration
--> Toolbars
-->AdminToolbar.ascx

I want to pass this control as a paramter from within a standard .aspx page located in the root directory.

My problem is that my user control is not available in any class that is outside of the Toolbars directory.

I've tried moving my control to the App_Code directory which then makes it available to other classes but the compiler complains that i'm not allowed to placed my user control int hat directory.

Any ideas how I can reference my web user control from other classes?

TIA

Smeat
 
What are you trying to do with the control? Are you trying to place it on a page dynamically?
 
I'm trying to pass it as a parameter to a master page so that the master page can dynamically load it.

Smeat
 
See if this helps you ...

HttpContext.Current.Request.ApplicationPath() + "/Administration/ToolBars/AdminToolbar.ascx
 
Thanks Jbenson001

I haven't tried this option so it may well work but i'm hoping there is a better solution as this one would require me to change my modify my master page each time a create a new toolbar user control.

Surely there must be a way for me to have a user control in a directory and then be able to access it in code from another directory.

Any ideas anyone?

TIA

Smeat
 
this one would require me to change my modify my master page each time a create a new toolbar user control.
Why? What exactly are you trying to do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top