TextBox
에서 AjaxControlToolkit의 AutoCompleteExtender
을 사용하고 있습니다.자동 완성 AJAX가 작동하지 않습니다.
내가 드래그하면, 간단히 말하면 내 텍스트 상자에에 AutoCompleteExtender
도구를 드롭하고 다음을 클릭합니다 "자동 완성 페이지 방법을 추가", 나는 다음과 같은 오류 얻을 : 오류를 인터넷 검색 후
Cannot create page method "GetCompletionlist because no CodeBehind or CodeFile was found!
을, 기본적으로 AutoCompelte.asmx라는 자체 웹 서비스를 만들었습니다. 나는 데이터베이스에서 데이터를 가져 오는되어야한다 나중에 .... 물론
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace AutoCompleteTest
{
/// <summary>
/// Summary description for AutoComplete
/// </summary>
[WebService(Namespace = "http://microsoft.com/webservices/")]
[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 AutoComplete : System.Web.Services.WebService
{
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
// Create array of movies
string[] movies = { "Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II" };
// Return matching movies
return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}
}
}
, 위의 더미 데이터입니다 : 다음은 그 클래스에 대한 코드입니다.
는 그리고 내을 Default.aspx은 다음과 같습니다
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
From
<asp:TextBox ID="txtFrom" runat="server">
</asp:TextBox>
<asp:AutoCompleteExtender runat="server"
ID="txtFrom_AutoCompleteExtender"
TargetControlID="txtFrom"
ServiceMethod="GetCompletionList"
ServicePath="AutoComplete.asmx"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20"
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
</asp:AutoCompleteExtender>
나는 웹 사이트를 실행 ....와 텍스트 상자를 입력, 아무 일도 일어나지 않습니다. Extender가 표시되지 않습니다. 내가 "스타"라고 입력해도.
무엇이 누락되었는데 처음에 오류가 발생 했나요?
P. 나는 대학 컴퓨터에있어, 나는 그 오류가 내가 사용하고있는 네트워크의 유형 때문일 것이라고 생각한다. 확실하지 않다.
어떤 도움도 대단히 대단히 감사하겠습니다!
감사합니다.
나는 그것을 작동시켰다. 기본적으로 웹 사이트 응용 프로그램 대신 웹 사이트를 만들었습니다. 어떤 이유로, 문제가 해결되었습니다. – Subby
정말 답변으로 게시해야합니다. –