1. I use WSPBuilder (http://www.codeplex.com/wspbuilder) to build my SP web
part, which has Ajax feature. That is the ScriptManager exists on the
sharepoint page. The web part has these code:
using AjaxControlToolkit;
private AutoCompleteExtender autoComplete = new AutoCompleteExtender();
private TextBox TB_SearchSubject = new TextBox();
protected override void CreateChildControls()
{
base.CreateChildControls();
TB_SearchSubject.ID = "TB_SearchSubject";
TB_SearchSubject.Width = 120;
this.Controls.Add(TB_SearchSubject);
System.Web.UI.HtmlControls.HtmlGenericControl div = new
System.Web.UI.HtmlControls.HtmlGenericControl();
div.ID = "ListPlacement";
div.Attributes["style"] = "height:300px;
overflow-y:scroll;";
this.Controls.Add(div);
autoComplete.ID = "AutoComplete1";
autoComplete.MinimumPrefixLength = 1;
autoComplete.CompletionSetCount = 20;
autoComplete.CompletionInterval = 1000;
autoComplete.DelimiterCharacters = ";, :";
autoComplete.CompletionListElementID = "ListPlacement";
autoComplete.EnableCaching = true;
autoComplete.ServicePath =
"../12/TEMPLATE/LAYOUTS/AutoCompleteWebService.asmx";
autoComplete.ServiceMethod = "GetSubjects";
autoComplete.TargetControlID = "TB_SearchSubject";
autoComplete.ContextKey = "Just testing";
this.Controls.Add(autoComplete);
}
2. The web service file AutoCompleteWebService.asmx inside the same project
as step 1 has this code:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoCompleteWebService : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetSubjects(string prefixText, int count, string
contextKey)
{
if (count == 0)
{
count = 10;
}
List<string> items = new List<string>(count);
ArrayList arr_test = new ArrayList();
arr_test.Add("ab");
arr_test.Add("kg");
arr_test.Add("iq");
arr_test.Add("le");
arr_test.Add("cd");
for (int i = 0; i < arr_test.Count; i++)
{
items.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(arr_test[i].ToString(), arr_test[i].ToString()));
}
return items.ToArray();
}
}
3. Now, I build and deploy WSP file to the SharePoint server in my dev box.
Deployment is OK. The web part is displayed on the sharepoint page. I have
checked that the file AutoCompleteWebService.asmx indeeds locates at ../12/
TEMPLATE/LAYOUTS/AutoCompleteWebService.asmx.
Now, I enter “a” to the text box, a list of “undefined” appears (all the
items are “undefined”). If everything worked, “ab” should be displayed as I
have “ab” item in the ArrayList (see the code above).
4. If I place the AutoCompleteExtender to a normal ASP.NET app and the web
service asmx file exactly has the same code as above, it works and “ab” is
shown.
So, what things go wrong in the SharePoint web part?
If you know what problem is, could you make comment about it? Thanks.
Stock
You can reference my AJAX lab and see if there may be anything you might
have missed in your deployment.
http://cbt.architectingconnectedsystems.com/50064/50064%20_Module_14.htm
Chris
"Pat" <Pa...@newsgroups.nospam> wrote in message
news:3A41247B-F63F-4847...@microsoft.com...
So, the question to you is: how do you deploy customized web service to the
SharePoint production box? Do you use a tool such as WSPBuilder, or manually
copy and paste?
Thanks
Pat