HowTo: Use globally defined resources in your ASPX code
2 min read
2 min read
When creating localized web applications using ASP.net you may often come across strings which are the same on many of your interface parts. Usually you probably use the VS functionality "Generate local resources" which creates you an appropriate resx file containing the keys of your ASP.net Page or UserControl. But take for instance the simple example of a "save button" having the text "Save".
Using the "generate resources" approach will lead to a situation where the text "save" appears in many different resx files. This may render it particularly difficult to make changes afterwards, i.e. when your customer suddenly wants to have the text "save content" instead of "save" alone. It would therefore make perfectly sense to have this kind of text defined globally. This can be done quite easily:<asp:Button id="btnSubmit" runat="server" Text="<%$ Resources:GlobalResources, Button_Save %>"/>