This seems to be an under documented feature of ASP.NET 2.0.
You can easily embed resources (text files, images, etc) in you assemblies. This is very handy for server control deployment. However the documentation for this is somewhat lacking.
Here goes:
At the top of your class add an attribute to allow an embedded attribute:
[assembly: WebResource("MyProject.ResourcesFolder.JavascriptFolder.AutoCompleteTextBox2.js", "text/javascript")]
(This can also go in the AssemblyInfo.cs)
One big gotcha here is the fact that the first argument is the default namespace + folder location + the actual name of the file to embed.
So if my default namespace is "MyProject" and the file is located in /Resources/Javascript and named AutoCompleteTextBox2.js then the resource will be embedded correctly.
Then to make sure that the javascript link is embedded in the page:
protected override void OnPreRender(EventArgs e)
{
this.Page.ClientScript.RegisterClientScriptResource(
typeof(MyType),
"MyProject.ResourcesFolder.JavascriptFolder.AutoCompleteTextBox2.js");
base.OnPreRender(e);
}
You need to place this in the PreRender event handler for the code to be placed correctly in the page.
Finally, make sure your resource is compiled into your assembly. By Changing the build action on EACH resource that you want to include. Check out the image below. the date_control.js file is now an embedded resource and can be accessed using the methods listed above.