Having trouble reading a value from View.ascx.resx from code behind
I have the following files: View.ascx, View.ascx.cs, View.ascx.resx . In
the file View.ascx.resx, I'm have a lot of trouble reading the value for
the key EmailAddress.Text from my code behind.
I tried this:
object keyValue =
System.Web.HttpContext.GetLocalResourceObject("~/View.aspx",
"EmailAddress", culture);
EmailAddress.Attributes["placeholder"] = keyValue.ToString();
And it gave me the error:
Error: Contact is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: The resource class for
this page was not found. Please check if the resource file exists and try
again. ---> System.InvalidOperationException: The resource class for this
page was not found. Please check if the resource file exists and try
again. at
System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager()
at System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager()
at System.Web.Compilation.BaseResXResourceProvider.GetObject(String
resourceKey, CultureInfo culture) at
System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider
resourceProvider, String resourceKey, CultureInfo culture, Type objType,
String propName) at System.Web.HttpContext.GetLocalResourceObject(String
virtualPath, String resourceKey, CultureInfo culture) at
com.John.Contact.View.Page_Load(Object sender, EventArgs e) in
C:\Users\john\Documents\My Web
Sites\v624\DesktopModules\Contact\View.ascx.cs:line 74 --- End of inner
exception stack trace ---
I tried this:
ResourceManager rm = new ResourceManager("items",
System.Reflection.Assembly.GetExecutingAssembly());
String r = rm.GetString("EmailAddress");
And it gave me this error:
Error: Contact is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Could not find any
resources appropriate for the specified culture or the neutral culture.
Make sure "items.resources" was correctly embedded or linked into assembly
"Contact" at compile time, or that all the satellite assemblies required
are loadable and fully signed. --->
System.Resources.MissingManifestResourceException: Could not find any
resources appropriate for the specified culture or the neutral culture.
Make sure "items.resources" was correctly embedded or linked into assembly
"Contact" at compile time, or that all the satellite assemblies required
are loadable and fully signed. at
System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String
fileName) at
System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo
culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean
createIfNotExists, StackCrawlMark& stackMark) at
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
requestedCulture, Boolean createIfNotExists, Boolean tryParents,
StackCrawlMark& stackMark) at
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
culture, Boolean createIfNotExists, Boolean tryParents) at
System.Resources.ResourceManager.GetString(String name, CultureInfo
culture) at System.Resources.ResourceManager.GetString(String name) at
com.John.Contact.View.Page_Load(Object sender, EventArgs e) in
C:\Users\john\Documents\My Web
Sites\v624\DesktopModules\Contact\View.ascx.cs:line 80 --- End of inner
exception stack trace ---
I tried several other example from the asp.net code library, but kept
getting other errors. How do I grab a value from the View.ascx.resx file?
No comments:
Post a Comment