Reputation: 20140
Should I use the resource file directly in the aspx page like
<asp:Literal ID="userManagementSave" Text="<%$ Resources: save_lbl %>" runat="server" />
or creating a sub in the code like
private sub setLang()
userManagementSave.text = GetLocalResourceObject("save_lbl")
end sub
Upvotes: 0
Views: 536
Reputation: 293
I'm currently using VSTS 2008 but I seem to remember this capability being available in VS2005 also ...
Basically use the inbuilt support for generating Local Resources
N.B. Html has been updated to include meta tags
This is a useful technique because it generates resources for all the properties of controls that are required to be provided to make a page fully multi-language/all strings stored in resources i.e. alt on Image - always forget that one! You don't have to provide text for all resource keys if you don't want to.
Upvotes: 0
Reputation: 958
Ern's answer is good. Typically, when you're maintaining code, if you have to fix something on the page, you're going to start looking in the aspx file first, just find the name of the control. If that code is inline, you'll find it immediately and won't have to jump around to find it.
If you find yourself writing any more code in the aspx than this property assignment, move at least to the code-behind, because code is harder to debug and read in the aspx.
Upvotes: 1
Reputation: 1512
I favor referencing the text inline, since it is easier to update by not being in the code behind.
Since the only functionality you are after is content output, you'll be fine doing it inline. If you were doing anything more complicated, then a method in the code behind would be better.
Upvotes: 1