Click here to Skip to main content
13,000,017 members (46,373 online)
Rate this:
Please Sign up or sign in to vote.

I localized an ASP.Net web application with resx files in App_GlobalResources and it worked quite well. I could get resources from code behind and from markup with explicit (like this : <%$ Resources:Resource1, MyString1 %>)

Now, I am trying to embed resources into satellite assemblies. For each resource file, I set Embedded Resource in visual studio IDE, it works well in the code behind but I can't figure out how to get the resources from satellite assemblies from within the markup.

I googled this and I found only web sites talking about resources called from satellite assemblies from within code behind.

Is there a way to get resources from markup with satellite assemblies?

Thanks for your help
Posted 7-May-11 23:59pm
Updated 8-May-11 3:58am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have you marked the resx's default Access Modifier to public? It defaults to Internal.

Take a squizz at this[^] and seach for "Now set the access modifier to public" the rest of the article is irrelevant.
Christophe_ 9-May-11 14:41pm
Thanks for your answer.

Yes, the modifier was already set to public. Following the page sample you provided me, I was able to localize a value in the markup but this only worked outside of controls.

An example will be clearer I think ;). Assuming I have a localized string MarkupText in a resource file Resource2 :


<!--this one worked-->
<%= Resources.Resource2.MarkupText %>

<!-- this one doesn't work -->
<asp:Label runat="server" ID="label1" Text="<%=Resources.Resource2.MarkupText%>"/>

<!-- this one doesn't work with satellite assemblies but worked with standard resx -->
<asp:Label runat="server" ID="label2" Text="<%$Resources:Resource2,MarkupText%>"/>


Why can't I use <%$... %> notation like in resx version ?
Keith Barrow 9-May-11 15:55pm
Try Changing the first one to Text="<%= Resources....." note the extra space, I've found it a bit finnicky. The second one has a "," instead of "." after Resource2, please check this isn't a typo.
Christophe_ 11-May-11 3:22am
I tried
<asp:TextBox runat="server" ID="textbox1" Text="<%= WebApplication.Resource2.Markup1 %>" />

<asp:TextBox runat="server" ID="textbox2" Text="<%= Resource2.Markup1 %>" />

<asp:TextBox runat="server" ID="textbox3" Text="<%$ Resources:Resource2.Markup1 %>" />

<asp:TextBox runat="server" ID="textbox4" Text="<%$ Resources:Resource2, Markup1 %>" />

<asp:TextBox runat="server" ID="textbox5" Text="<%$ Resources:WebApplication.Resource2, Markup1 %>" />

<asp:TextBox runat="server" ID="textbox6" Text="<%$ Resources:WebApplication.Resource2.Markup1 %>" />

None of them worked.

PS : Here is a link to VS2010 solution if anyone sees what I am doing wrong
VS2010 Solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 8 May 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100