Embedding Localized Resources for a JavaScript File In ASP.NET

235 Views Asked by At

I want to embed my resource file in my javascript file.

I have:

  • global.resx

  • main.js

  • default.aspx

Added this to the assembly.cs:

[assembly: System.Web.UI.WebResource("main.js", "application/x-javascript")]

[assembly: System.Web.UI.ScriptResource("main.js", "Resources.Global", "Resources")]

Changed main.js to embed resource

I did exactly as stated here: Embedding Localized Resources for a JavaScript File

But I still get that Resources is "undefined" in my js.

0

There are 0 best solutions below