Retrieving Local Resource Values correctly: GetGlobalResourceObject or .NET Control?
While developing I've seen a couple different ways to get local res开发者_StackOverflow中文版ources values from the resx files. Which one is considered the best practice?
Using the GetGlobalResourceObject method:
<a id="myLink" href="#"><%= GetGlobalResourceObject("Filter","Diary")%></a>
Or using a control and setting the value directly in the resx:
Any better ways I should know? Thanks for your help!
Basically the names tell everything: Global Resources and Local Resources.
If you need the same resource to be used in different places (pages, controls, back-end, etc.) use Global Resources. Local resources are tight to pages and user controls. You should be creating one local source file for each page (aspx) and user controls (ascx).
精彩评论