自动完成搜索文本框AJAX ASP.NET中的问题 [英] Problem in AutoComplete Search text box AJAX ASP.NET
问题描述
我已经尝试了几天,但无法使用自动完成的AJAX控件
这里的代码是
IN HomePage.aspx文件
< div >
< asp:TextBox ID = SearchBox runat = server < span class =code-attribute> CssClass = divFor_SearchBox OnTextC hanged = SearchBox_TextChanged > < / asp:TextBox >
< asp:ScriptManager ID = < span class =code-keyword> ScriptManager1 runat = server > < / asp:ScriptManager >
< asp:autoco mpleteextender
id = AutoCompleteExtender1 runat = server targetcontrolid = SearchBox
minimumprefixlength = 1 completioninterval = 10 enablecaching = true
< span class =code-attribute> usecontextkey = True servicemethod = HelloWorld ServicePath = 〜/ AutoComplete。 asmx >
< / asp:autocompleteextender >
< / div >
IN AutoComplete.asmx
使用系统;
使用 System.Collections;
使用 System.Configuration;
使用 System.Data;
使用 System.Data.SqlClient;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.Services;
使用 System.Web.Services.Protocols;
使用 System.Xml.Linq;
命名空间 WebApplication2
{
/// < 摘要 >
/// AutoComplete
的摘要说明 /// < / summary >
[WebService(Namespace = http://tempuri.org/)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 允许使用ASP.NET AJA从脚本调用此Web服务X,取消注释以下行。
[System.Web.Script.Services.ScriptService]
public class AutoComplete:System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return Hello World;
}
}
}
我在哪做什么错误??
请帮帮我,我厌倦了这件事:(
你好朋友,
尝试在网络服务中更改您的Helloworld功能,如下所示:
[ WebMethod]
public string HelloWorld( string prefixText, int count)
{
return Hello World;
}
希望它能解决您的问题。
如需更好的参考,请查看本网站。
< a href =http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx> http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx [< a href =http://www.asp.net/ajaxLibrary/Aj axControlToolkitSampleSite / AutoComplete / AutoComplete.aspxtarget =_ blanktitle =New Window> ^ ]
hey,
I have been trying it for days, but unable to use autocomplete AJAX control
here is the code
IN HomePage.aspx File
<div>
<asp:TextBox ID="SearchBox" runat="server" CssClass="divFor_SearchBox" OnTextChanged="SearchBox_TextChanged" ></asp:TextBox>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:autocompleteextender
id="AutoCompleteExtender1" runat="server" targetcontrolid="SearchBox"
minimumprefixlength="1" completioninterval="10" enablecaching="true"
usecontextkey="True" servicemethod="HelloWorld" ServicePath="~/AutoComplete.asmx">
</asp:autocompleteextender>
</div>
IN AutoComplete.asmx
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace WebApplication2
{
/// <summary>
/// Summary description for AutoComplete
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
where am i doing wrong??
please help me, I am tired of this thing :(
Hi friend,
Try to change your Helloworld function in webservice as follows:
[WebMethod] public string HelloWorld(string prefixText, int count) { return "Hello World"; }
Hope it will solve your problem.
For better reference check this site.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx[^]
这篇关于自动完成搜索文本框AJAX ASP.NET中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!