예제 #1
0
        public JavaScriptResult Resource(string name = "resources", string path = "Resources")
        {
            // Clean up any references to .resx - our code enters that automatically.
            if (path.Contains(".resx"))
            {
                path = path.Replace(".resx", "");
            }

            // Create our factory
            var service = new ClientResourceService();

            service.JavaScriptObjectName = name;
            service.GlobalResXFileName   = path;

            // Write our javascript to the page.
            return(JavaScript(service.GetJavaScript()));
        }
예제 #2
0
        public JavaScriptResult Resource(string name = "resources", string path = "Resources")
        {
            // NOTE: The GetJavaScript method assumes you will be precompiling the project during publishing.
            // IF this is not the case, you will need to remove the isLocal parameters, as the App_GlobalResources file will not be compiled into the bin file.
            // Locally this folder is outside of the bin folder
            // Also note that in order for the resx files to be updated correctly you must open the App_GlobalResources folder in the Common project (individual projects not necessary), select all the .resx files, right-click and choose properties, and then, in the Copy to Output Directory, choose "copy always"

            // Clean up any references to .resx - our code enters that automatically.
            if (path.Contains(".resx"))
            {
                path = path.Replace(".resx", "");
            }

            // Create our factory
            var service = new ClientResourceService();

            service.JavaScriptObjectName = name;
            service.GlobalResXFileName   = path;

            // Write our javascript to the page.
            return(JavaScript(service.GetJavaScript(Request.IsLocal)));
        }