Hi,
one approach that I use is to create a static class called WebResources, put it under the desired namespace and define the metadata attributes there:
namespace MyNamespace {
// Declare all the embedded resources here.
[assembly: WebResource("MyNamespace.Javascript.Global.js", "text/javascript")]
public static class WebResources {
}
}
and then, to register an embedded resource, pass the type of the static class and then the reference to the resource in the form Namespace.Directories.FileName:
Page.ClientScript.RegisterClientScriptResource(typeof(MyNamespace.WebResources), "MyNamespace.Javascript.Global.js");
Finally, remember to set the Build Action for the desired resource file to 'Embedded Resource' (this can be done in the Properties window for that file).
Alessandro Gallo |
Blog | My book: ASP.NET AJAX In Action