0

I have a site that changes content on the page, based on which user is logged in. Some users have images(wrapped in an a tag)that are use for site navigation buttons. The users that don't have images use text(wrapped in an a tag) for these same buttons. I was wondering if I can just use a literal in these spots on the page and for the text attribute of the literal have something like:
Text="<%$ Resources:nextpageimage %>"

Then I could have a .resx file for each user. A user that has images would have something like this for a .resx file entry:

nextpageimage <img title="" src="~@/images/next.gif" />

.resx entry for user without image:

nextpageimage Next Page

Does this make sense and if so, the problem I am having, is finding syntax to choose which resource file I want to use. Basically right now I am using a switch statement:

switch(user)
case user1: 
resourcefile = user1.resx;
break;
case user2:
resourcefile = user2.resx

Any suggestions are appreciated. Thanks!

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by kcwebsites
0

I figured this out. I just had to leave the text attribute blank and set it in the code behind. I chose the resource file by using

var resourcefile = new System.Resources.ResourceManager("RootNamespace.ResxFileName",System.Reflection.Assembly.GetExecutingAssembly());

then I had access to the key value pairs in the corresponding .resx file.

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.