Transform different languages with simple settings and references
1, the new resource file resource.resx,vs2005 automatically put it in the App_GlobalResources folder;
2, open the resource file, enter the common string, the file is a collection of some key/value, key used to do the reference of the identity, value is used to represent the value of the string; (you can see that Resource.resx is actually an XML file after saving)
3, in the system for reference:
- CS File Reference: String strhint = Resources.Resource.key
- Normal references in ASPX files (character display):<td><%=resources.resource.key%> </td>
- Property value reference (do attribute value) in aspx file: <asp:requiredfieldvalidator id= "Rfvsnum" runat= "Server" errormessage= "<%$ Resources: Resource, key%> "controltovalidate=" Tbsnum "display=" dynamic "/>
Note: Resources is a namespace, resource is the class that operates resource files in. NET, and key is the one that you set in the resource file.
Use of ASP. NET resource Files