웹 서비스 메서드를 호출하지 제어 확장 :자동 완성 Extender는 내가 텍스트 상자 내 ASP.net 페이지에서 아약스 자동 완성 확장 제어를 사용하고
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace TestChart
{
/// <summary>
/// Summary description for AutoCompleteWebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class AutoCompleteWebService : System.Web.Services.WebService
{
public AutoCompleteWebService(){
}
[WebMethod]
public string[] GetItemsList(string Prefix,int count)
{
char c1;
char c2;
char c3;`enter code here`
if (count == 0)
{
count = 10;
}
Random rnd =new Random();
List<string> items = new List<string>();
for (int i = 0; i < count; i++)
{
c1 = Convert.ToChar(rnd.Next(65, 90));
c2 = Convert.ToChar(rnd.Next(97, 122));
c3 = Convert.ToChar(rnd.Next(97, 122));
items.Add(Prefix + c1 + c2 + c3);
}
return items.ToArray();
}
}
}
내가 개별적으로 작동이 잘되는 웹 서비스 만 때이 텍스트 상자가 자동 완성 옵션이 표시되지 프로젝트를 실행을 실행합니다.
누구든지 실수를 분석하는 데 도움을 줄 수 있습니까?
덕분에 사전에
이것은 오래된 질문이지만 동일한 문제가있어서 매개 변수의 이름을 정확하게 지정해야합니다. 내 경우에는 contextKey를 사용하고 웹 서비스 메서드는 다음과 같습니다. [WebMethod(), ScriptMethod()] public static string [] GetCompletionListOther (string prefixText, int count, string contextKey). 이것은 기본적으로 Ankur가 Monika의 답변에 대한 자신의 의견에서 말한 것입니다. – shev72