Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Assembly with USER controls (ascx) cannot find its resouces

Reply
Thread Tools

Assembly with USER controls (ascx) cannot find its resouces

 
 
mschep@deloitte.nl
Guest
Posts: n/a
 
      03-14-2006

Hi,

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
(named BunchOfUserControls.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
a website.
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
code.
<name sub folder> is the folder were I've got my user controls in the
original solution.
So creating the user control dynamicly you need to do the following:

Assembly assembly = Assembly.Load("BunchOfUserControls");
object instance =
portletAssembly.CreateInstance("ASP.mysubfolder_my usercontrol_ascx");
myPage.Controls.Add((Control)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
assemblies.
Web deployment project creates an assembly for the resources:
App_LocalResources.mysubfolder.cdcab7d2.dll
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?

Kind regards,

Michel

 
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
Parser Error Message: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified. hifiger2004 ASP .Net Web Controls 1 08-30-2007 04:12 PM
Assembly with USER controls (ascx) cannot find its resources mschep@deloitte.nl ASP .Net 0 03-14-2006 11:07 AM
Visual Studio 2005 C++ Resouces Kris C++ 2 01-18-2006 09:18 PM
sharing resouces =?Utf-8?B?d2FkZQ==?= Wireless Networking 6 01-10-2006 01:42 AM
Memory leakage on win98SE server : system resouces decrease form 70% -> 0% in 24 hours No Shit ! Computer Support 5 05-09-2004 08:31 AM



Advertisments