I'm a beginner in the black art of ASP .NET development, so forgive me if this is a stupid question. After a bit of googling, and reading though (some of...) ASP .NET 3.5 Unleashed, I've yet to find a way of doing what I want - which usually either means I'm trying to do something stupid, or it's so obvious I've missed it :)
I'm creating a Server Control for use across multiple sites my company is developing. It's nothing fancy, just a standard here-you-may-edit-and-create-users control.
Doing so naturally requires localization of some text.
The natural way of doing this, for me, would be a global resource named after some convention which the projects that include the server control may then fill with localized data.
However, I'm having some trouble accessing these resources from within my component.
Having created in Project A in the App_GlobalResources folder a resource file called CreateOrEditUserControl.da.resx (side note: do I need to add my App_GlobalResources folder to the web-config or something?). Project A includes the CreateOrEditUserControl which is from project B and loaded via an assembly reference. CreateOrEditUserControl.da.resx contains the key UserName mapped to the string Brugernavn (this is just a Danish localization, as you may have guessed...)
Inside my control in the CreateChildControls() method (as I need the localized strings here), I've tried accessing the resources the following ways:
HttpContext.GetGlobalResource("CreateOrEditUserControl","UserName");
HttpContext.GetGlobalResource("CreateOrEditUserControl.da","UserName");
HttpContext.GetGlobalResource("CreateOrEditUserControl.da.resx","UserName");
HttpContext.GetLocalResource("CreateOrEditUserControl.da.resx","UserName");
the first three of which return null, and the last of which throws an exception since I do not have the rights to said resource from within my component, which seems logical.
So far I've had to resort to a "hack", in which you can specify language in the querystring and I manually insert the strings. This is undesirable, however, as any change would require change in the component, not just on the user...
What is the right way of doing this - if there is one?
Thanks in advance!