To get the ResourceManager for LocalResources in a asp.net website webform use this snippet
protected System.Collections.Hashtable GetLocalResourceStringEntries() { var localResourceStringEntries = new System.Collections.Hashtable(); var f = typeof(TemplateControl).GetField("_resourceProvider", BindingFlags.NonPublic | BindingFlags.Instance); if (f == null) return localResourceStringEntries; var resourceProvider = (System.Web.Compilation.IResourceProvider)f.GetValue(this); if (resourceProvider.ResourceReader == null) return localResourceStringEntries; foreach (System.Collections.DictionaryEntry de in resourceProvider.ResourceReader) { if (de.Value is String) localResourceStringEntries[de.Key] = de.Value; } return localResourceStringEntries; }
No comments:
Post a Comment