Last post Mar 28, 2006 11:32 AM by rmprimo
Mar 27, 2006 04:56 AM|part.diff.eq.|LINK
Is there any way to reference a LocalResource file .resx in CodeBehind?
I have a multilingual web project with several LocalResources and i would like to add some custom values to them, which I like to use in CodeBehind, for example:
DropDownList.Items.Add(<string from LocalResource file depending on user language>)
Thanks in advance for your responses.
Mar 27, 2006 12:54 PM|rmprimo|LINK
Mar 28, 2006 02:34 AM|part.diff.eq.|LINK
Yeah, thank you, works great!
The direct method gets the language info from CultureInfo, right?
So I can influence the automatically chosen .resx-file by changing the thread`s CultureInfo, can I?
Mar 28, 2006 05:06 AM|Edfranz|LINK
Hello if you want to use HttpContext.GetLocalResourceObject
don't forget to use "~" before the path of the resource.
I've got the same problem in the codebehind.
But the easiest way to get the local resource is in the code behind from the Page and call
Mar 28, 2006 11:32 AM|rmprimo|LINK
All these methods get the current culture from the thread.
Best way to access that in your case would be right form the static properties: