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!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.