I am writing a server control that is a search box with suggestions (when the user starts typing, matching words will appear for them to select). I am using jquery and C#.
The control works fine when I include the jquery Lib on the page that I am testing on. However, it will not work when I attempt to embed the lib in the DLL.
I have tried completely embedding it and registering the script:
ClientScriptManager manager = this.Page.ClientScript;
manager.RegisterClientScriptResource(typeof(Search), jqueryResource); //jqueryResource= SearchControl.javascript.jquery.js
and I am also tried just adding a tag in the header of the page that includes the jquery:
string javascriptUrl = manager.GetWebResourceUrl(typeof(Search), jqueryResource);
LiteralControl jquery = new LiteralControl(string.Format(javascriptInclude, jqueryUrl));
Page.Header.Controls.Add(jquery);
Both ways cause javascript errors (Object Expected) when trying to get information from controls
var params = $("#searchBox").val(); //called on keyup when typing in textbox
Has someone done this before? Is it possible? Can someone shed some light on this?
PS: Assemblies are already registered in the AssemblyInfo.cs file.