Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Resource expression to access resource located in library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Heinrich Moser - 11 Mar 2008 21:58 GMT
Hi!

(This posting refers to Visual Studio 2008.)

I'm moving part of my asp.net application into a library, to be able
to reuse that (server control) code for other projects. This also
includes some localized text resources. These resources need to be
usable by the library as well as by ASP.NET projects using that
library.

First problem: The auto-generated class for the resx in the library
(ShopTexte.resx) is Friend/interal instead of public. I know that
there are third-party-ResXFileCodeGenerator-replacements out there
that fix this, but I'd prefer a solution without Visual Studio plugins
because it makes life easier for my co-developers.

So I thought I'd make a proxy class in the library project for the few
resources that need to be shared:

Namespace Resources
   Public Class ShopTexteProxy
       Public Shared ReadOnly Property Warenkorb() As String
           Get
               Return ShopTexte.Warenkorb
           End Get
       End Property
       ... other resources ...
   End Class
End Namespace

This works fine from code, but I cannot access this resource from an
aspx page. Neither

<asp:Localize Runat="server" Text="<%$ Resources:ShopTexte, Warenkorb %>" />

nor

<asp:Localize Runat="server" Text="<%$ Resources:ShopTexteProxy, Warenkorb %>" />

works. Of course, resx files residing in the asp.net project work
fine. How can I access my resx files residing in the library using
resource expressions? Or am I doing something conceptually wrong?

(The library and the asp.net project both use the same root namespace,
so it shouldn't be a namespace issue.)

Greetings,
   Heinzi
Heinrich Moser - 27 Mar 2008 17:25 GMT
Hi!

> I'm moving part of my asp.net application into a library, to be able
> to reuse that (server control) code for other projects. This also
[quoted text clipped - 10 lines]
> So I thought I'd make a proxy class in the library project for the few
> resources that need to be shared:

In the mean time, I discovered that this is no longer necessary in
Visual Studio 2008, since you can change the access modifier (Friend
or Public) in the resource editor.

Still, the question remains: How can I use a resource expression with
a resource file located in a referenced library, i.e. how can I do

<asp:Localize Runat="server" Text="<%$ Resources:ResourceFileInLibrary, SomeName %>" />

Greetings,
   Heinzi

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.