当前位置: 代码迷 >> ASP.NET >> AutoCompleteExtender 调用没反应解决办法
  详细解决方案

AutoCompleteExtender 调用没反应解决办法

热度:9995   发布时间:2013-02-25 00:00:00.0
AutoCompleteExtender 调用没反应
HTML code
<%@ Register    Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtool" %><body>    <form id="form1" runat="server">    <ajaxtool:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">    <Services>     <asp:ServiceReference Path="~/BackStage/City.asmx" />    </Services>    </ajaxtool:ToolkitScriptManager>    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>    <ajaxtool:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1" CompletionSetCount="12" ServiceMethod="GetCompleteList" ServicePath="City.asmx"  MinimumPrefixLength="1">    </ajaxtool:AutoCompleteExtender>    </form></body>



WEBSERVICE
C# code
 /// <summary>    /// CityData1 的摘要说明    /// </summary>    [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]      // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。    [System.Web.Script.Services.ScriptService]    public class City : System.Web.Services.WebService    {        public City()        { }        A380lines.BLL.CityData bll_city = new BLL.CityData();        [WebMethod]       [System.Web.Script.Services.ScriptMethod]         public string [] GetCompleteList(string prefixText,int count)        {            List<string> items = new List<string>(count);            DataSet ds = A380lines.SQLServerDAL.DbHelperSQL.Query("select top "+count+" cnname from citydata where cnname like '"+prefixText+"% ' group by cnname order by cnname");            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)            {                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)                {                    items.Add(ds.Tables[0].Rows[i]["cnname"].ToString());                }            }            return items.ToArray();        }    }




------解决方案--------------------------------------------------------
ServicePath="City.asmx"

路径写错了,应该写上文件夹名称


------解决方案--------------------------------------------------------
探讨

报错又不报错,又没反应

------解决方案--------------------------------------------------------
先测试websercie,没有错误的话再进行下一步
  相关解决方案