Referring to User Control in a different project

G

Guest

Hello everybody,

I have created a web site which has a simple user control
(LogoDisplay.ascx). This is part of a separate project called CommonControls.

I have a main Project "MainProj" from which I am referring to
"CommonControls". I have a web page Default.aspx page in MainProj that has a
UserControl "Header.ascx"

Files for "MainProj" Project file are under folder
"C:\inetup\wwwroot\MainProj"
Files for "CommonControls" Project file are under folder
"C:\inetup\wwwroot\CommonControls"

From Header.ascx user control, I am referring to LogoDisplay.ascx User
control in CommonControls projects.

The register tag in Header.ascx file looks like below

<%@ Register TagPrefix="MYCONTROL" TagName="LogoDisplay"
Src="CommonControls/LogoDisplay.ascx" %>


When I run the project I get the following error

Could not find a part of the path
"C:\Inetpub\wwwroot\MainProj\CommonControls\LogoDisplay.ascx".

I don't understand why in the above path display
"CommonControls\LogoDisplay.ascx" is concatenated with
"C:\Inetpub\wwwroot\MainProj". CommonControls is under wwwroot folder not
under MainProj folder!

Can anyone help me in resolving this issue. Basically I want to refer to a
user control in another project from a user control in another project

Thanks
pradeep
 
G

Guest

The path that you specify within a project will be interperted as relative to
that project's root application folder. You have to copy that ascx file to
the new project if you want to be able to use it in there. You cannot access
controls across applications, unless you copy them in each project, or
compile them and place the dll in each bin folder or place them in the GAC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top