2013-09-24 3 views
0
내가 서버 코드를 사용하여 모든 국가에서 모든 도시를로드 할 아약스 자동 완성 익스텐더를 사용하고

.. 내가 "금지"를 클릭하면아약스 자동 완성 익스텐더는 오류

모든 결과의 집합이 될 것입니다 .. 잘 작동을 던졌습니다 추가되었습니다. 첫 번째 장소는 방갈로, 두 번째는 방코그 등입니다. 키를 눌러 아래로 이동하면 bangkog 및 기타 오류가 발생합니다.

자바 런타임 에러

: 위의 용액 LIS

jaascript runtime error:System.argumentnullexception:value cannot be null.parameter name :classname in ajax autocomplete extender 

영문

<autofill:AutoCompleteExtender BehaviorID="AutoCompleteEx" ServiceMethod="GetCompletionList" 
             ID="fromlocation_AutoCompleteExtender" runat="server" DelimiterCharacters="" 
             Enabled="True" ServicePath="" TargetControlID="fromlocation" UseContextKey="True" 
             MinimumPrefixLength="2" CompletionInterval="10" EnableCaching="true" CompletionSetCount="20" 
             CompletionListItemCssClass="autocomplete_listItem"> 
             <Animations> 
      <OnShow> 
       <Sequence> 
        <OpacityAction Opacity="0" /> 
        <HideAction Visible="true" /> 

        <ScriptAction Script=" 
         // Cache the size and setup the initial size 
         var behavior = $find('AutoCompleteEx'); 
         if (!behavior._height) { 
          var target = behavior.get_completionList(); 
          behavior._height = target.offsetHeight - 2; 
          target.style.height = '0px'; 
         }" /> 

        <Parallel Duration=".4"> 
         <FadeIn /> 
         <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" /> 
        </Parallel> 
       </Sequence> 
      </OnShow> 
      <OnHide> 
       <Parallel Duration=".4"> 
        <FadeOut /> 
        <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" /> 
       </Parallel> 
      </OnHide> 
             </Animations> 
            </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 Code,City FROM CCode WHERE City LIKE '" + prefixText + "%'", conn); 
      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

당신은 SP 필요 뿐만 아니라'CompletionListHighlightedItemCssClass' CSS를 ecify – Damith

답변

0

인 테드는 다른 forum..I에

AutoCompleteExtender Error

위의 코드에서 나는 단지

CompletionListItemCssClass="autocomplete_listItem" 

그러나 포럼 어떤것에

뿐만 아니라 아래의 코드를 정의하기 위해 언급 한 추가 인터넷 검색을하여 .. 발견 ..
CompletionListHighlightedItemCssClass="two" 

나는 그렇게했고, 지금 내 문제가 해결

..

관련 문제