I have a web application project and created two folders, Controls and SiteControls, inside Controls I have another folder called Reusable which has a web user control called Main.
I’m trying to load the control Main from another web user control which is inside the SiteControls folder using the below code
Hi, not a permission issue as I have now added everyone to the parent folder with all controls. Yes I'm using VS and I place the control on a page along with the dll in the bin directory and the error shows. Is there anyway I can check to see what path it's looking at? Thx
Ok the problem was the path needs to be the same as if the directory your looking at is the on your site. Since my project was separate to the site I changed the path to usercontrols\ which resolved.
Error loading control
I have a web application project and created two folders, Controls and SiteControls, inside Controls I have another folder called Reusable which has a web user control called Main.
I’m trying to load the control Main from another web user control which is inside the SiteControls folder using the below code
LoadControl = Page.LoadControl("~/Controls/Reusable/Main.ascx");
But no matter what I try I always get the error that the control could not be found? How could I resolve this?
Hi Bob
Can you check permissions for your folders?
Maybe IIS process hasn't access to this folder.
Thanks,
Alex
Hi I'm running this locally. The error suggests that it can't find the control so I thought I must have the wrong path?
Hi Bob
If your path is right, but process which is running hasn't access to folder you will get this error, so I would check access first.
Are you running site via visual studio?
Hi, not a permission issue as I have now added everyone to the parent folder with all controls. Yes I'm using VS and I place the control on a page along with the dll in the bin directory and the error shows. Is there anyway I can check to see what path it's looking at? Thx
Ok the problem was the path needs to be the same as if the directory your looking at is the on your site. Since my project was separate to the site I changed the path to usercontrols\ which resolved.
Thanks Alex for trying
You are welcome, Bob.
Glad that you find out what is the issue.
Have a nice evening!
/Alex
is working on a reply...