日期:2014-05-17  浏览次数:20393 次

AutoCompleteExtender 没有效果
测试页面代码 
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
 <asp:TextBox ID="TxtTel" runat="server"></asp:TextBox>
  <cc1:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" TargetControlID="TxtTel" MinimumPrefixLength="1" ServiceMethod="GetList" ServicePath="WebService.asmx">
  </cc1:AutoCompleteExtender>


WebService.cs代码

 [WebMethod]
  public string[] GetList(string prefixText, int count)
  {
  string[] returnValue1 = { "张飞", "张苞", "张郃", "张辽" };
  string[] returnValue2 = { "刘备", "刘禅", "刘璋", "刘表" };
  switch (prefixText.ToLower())
  {
  case "张":
  return returnValue1;
  case "zhang":
  return returnValue1;
  case "刘":
  return returnValue2;
  case "liu":
  return returnValue2;
  default:
  return new string[0];
  }
  }

输入"liu"没有任何自动提示功能 不知道哪里有问题

------解决方案--------------------
<asp:TextBox ID="TxtTel" runat="server"></asp:TextBox>
自动回传设了没啊,兄弟?
------解决方案--------------------
好像还要设置一个UseContextKey=true 把;

<asp:TextBox ID="txtMove_Name" runat="server"></asp:TextBox>
 <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="txtMove_Name"
MinimumPrefixLength="1" ServicePath="WebService.asmx" UseContextKey="true" runat="server"
ServiceMethod="GetCompletionList">
</cc1:AutoCompleteExtender>
------解决方案--------------------
你可以给版主发消息, 让他帮你处理,可以返回你的分