I've tried really hard to include a JavaScript file with my WebPart as a resource. The web part class and the flexidgrid.js file are both in the root level of the project. The Web Part is created in DisplaySearchResults.js:
namespace DisplaySearchResults
{
public class DisplaySearchResults : WebPart
{
### Hidden Irrelevant Stuff Here ###
protected override void CreateChildControls()
{
### Hidden Irrelevant Stuff Here ###
### Load JavaScript Code Here ###
string scriptURL = Page.ClientScript.GetWebResourceUrl(typeof(DisplaySearchResults), "DisplaySearchResults.flexigrid.js");
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsClientScriptBlockRegistered(ByeByeIncludeScriptKey))
cs.RegisterClientScriptInclude(this.GetType(), ByeByeIncludeScriptKey, scriptURL);
}
### Hidden Irrelevant Stuff Here ###
}
}
The AssemblyInfo.cs for DisplaySearchResults looks like this:
[assembly: WebResource("DisplaySearchResults.flexigrid.js", "text/javascript")]
But for some reason the WebResource.axd file still comes up as 404.
I had already set the Embedded Resource - it turned out I needed the fully qualified Assembly name - Company.UI.Web.DisplaySearchResults - which I got from right clicking on the properties menu of the project. On the application tab, there is the proper Assembly name.
So, instead of:
I should have put: