Last post Mar 08, 2008 03:14 AM by LordOfTheBathtubRings
Mar 07, 2008 11:23 PM|LordOfTheBathtubRings|LINK
I have a site that uses resource files to translate my site into various languages. It works fine for basic labels and such on the site.
However, I am now translating my dynamically generated error messages and I am having trouble. After several hours of trying last night I discovered the GetGlobalResourceObject method, but I am having trouble with getting the correct syntax.
Here's a snippet from my script:
if (pwd != "")
globalresourcestring = (String)GetGlobalResourceObject("MyLanguage", "client_center_validation_form_email_used") ;
FormMessage.Text += globalresourcestring;
And the portion of the page where it should output:
<asp:Label ID="FormMessage" runat="server" ForeColor="#CC0000" Font-Bold="true"></asp:Label>
Everything compiles fine, but when I run the page and view the source, this is what I see:
<span id="ctl00_MainContent_FormMessage" style="color:#CC0000;font-weight:bold;"></span>
What am I doing wrong? I'm very new to .NET and consider myself to know only enough about OO programming to be dangerous. ;)
Mar 08, 2008 01:50 AM|Tok Bek|LINK
I dont see any problem with your code.
Did you debug it ?
I can think of two things you should check :
1. Under Your Global Resource File check if there is value for "client_center_validation_form_email_used" key.
(Check the Resource file of the laguage you are testing)
2. if (pwd != "")
Check if this statement return true.
Mar 08, 2008 02:18 AM|LordOfTheBathtubRings|LINK
Thanks for your reply.
I debugged it only by setting "debug=true" at the top of my page file, and the output there does display that the password was returned correctly.
There is definitely a value for "client_center_validation_form_email_used" in the resource file. I copied/pasted it directly to ensure that I didn't make a typo.
I'm at a loss. [*-)]
Mar 08, 2008 02:35 AM|Tok Bek|LINK
Thats not the way to dubug.
Put a breaking point on the code line of your statement.
See this "Debugging" tutorial.
Mar 08, 2008 03:14 AM|LordOfTheBathtubRings|LINK
I know. [:$] I'm not using VWD, though, because it's an exercise in frustration every time I do. I inherited this huge app from someone else, and every time I open a file in VWD I get dozens of error messages (I'm actually not running anything locally
on my machine because I can't even get anything to compile and run on my machine -- ("It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being
configured as an application in IIS." -- even though I know the virtual directory is configured correctly.) So I just change the files, move to dev, browse to file, cross my fingers, and hope it works. Also, for some odd reason VWD is now showing everything
only in black and white -- I have looked in the options but I can't get the colors to come back. ARGH!
Terribly inefficient, but I have no other choice at this time.
Thanks for your help.