2013-09-23 13 views
0

我使用AjaxAutoComplete擴展填充在go.But我對此非常有問題的城市值導航。Asp.Net自動完成擴展填充值,按下箭頭後不經過人口稠密的價值

一切工作正常,但是當我按下箭頭在結果中導航,它什麼都不做,它不會從第一result..What移動我錯了在這裏做..

而且也值居住在上面的網頁,而不是textbox..Earlier低於它工作正常,但不是現在..

ASP.NET

<asp:TextBox ID="fromlocation" runat="server" CssClass="ddl"></asp:TextBox> 
<autofill:AutoCompleteExtender 
     ServiceMethod="GetCompletionList" 
     ID="fromlocation_AutoCompleteExtender" 
     runat="server" 
     DelimiterCharacters="" 
     Enabled="True" 
     ServicePath="" 
     TargetControlID="fromlocation" 
     UseContextKey="True" 
     MinimumPrefixLength="2" 
     CompletionInterval="10" 
     EnableCaching="true" 
     CompletionSetCount="3" 
     CompletionListItemCssClass="autocomplete_listItem"> 
</autofill:AutoCompleteExtender> 

C#

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] 
     public static string[] GetCompletionList(string prefixText, int count, string contextKey) 
     { 
      SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["connstring"].ToString()); 
      SqlCommand cmd = new SqlCommand("SELECT coalesce(Code + ', ', '') + City as codes FROM CCode WHERE City LIKE '" + prefixText + "%'", conn); 
      SqlDataReader oReader; 
      conn.Open(); 
      List<string> CompletionSet = new List<string>(); 
      oReader = cmd.ExecuteReader(CommandBehavior.CloseConnection); 
      while (oReader.Read()) 
       CompletionSet.Add(oReader["codes"].ToString()); 
      return CompletionSet.ToArray(); 

     } 

回答

0

對於上述的解決方案在另一個forum..I列出發現,通過使用Google ..

AutoCompleteExtender Error

在上面的代碼我僅加入

CompletionListItemCssClass="autocomplete_listItem" 

但在這個論壇大公所提到的定義下面的代碼以及..

CompletionListHighlightedItemCssClass="two" 

我做到了,現在我的問題就解決了..

相關問題