Assembly with USER controls (ascx) cannot find its resouces - 03-14-2006 , 12:24 AM
I built an assembly with a set of user controls.
This can be done with the Visual Studio 2005 Deployment Project:
building and merging for example all your aspx and ascx in one dll
Doing so it's possible to resuse user controls in other web projects
without transferring the ascx files. Just the dll.
'The reason I need this is because I need to load dynamicly controls in
This works fine.
The only thing to keep in mind is that it's not possible to use your
own class name.
Supose your user control is named MyNameSpace.MyUserControl the final
dll will contain a class named ASP.<name sub folder>_MyUserControl_ascx
This class is derived from my own class and overrides the
FrameworkInitialize method in order to render the ascx declarative
<name sub folder> is the folder were I've got my user controls in the
So creating the user control dynamicly you need to do the following:
Assembly assembly = Assembly.Load("BunchOfUserControls");
object instance =
This works fine. The page shows correcly the user control.
And now my problem: I need to localize my controls. Just created resx
files for some languanges and user the same technique to create my
Web deployment project creates an assembly for the resources:
Running the system again it produces an error after adding my control
to the page: cannot find resouce file.
After inspecting the resource dll (with Reflector) I see all my user
controls, however the've got the original names (MyUserControl). The
user control dll (with Reflector) shows mysubfolder_myusercontrol_ascx.
So I guess there is a problem matching the two.
Is there somebody knowing how to solve this problem?
|Thread Tools||Search this Thread|