2010-03-30 2 views
0

나는 내가 쓰고있는 페이지의 드롭 다운에 "데이터"를 저장하고 있었다. 그러나 사용자는 지금 드롭 다운을보고 싶지 않습니다. 나가 버리면 내 자동 완성 데이터에 제공 한 데이터가 사라집니다. 그래서 나는 별도의 .aspx 페이지를 만들고 그것을 그렇게 부르는 것이라고 생각했다. 작동하지 않습니다. 너 내가 뭘 잘못하고 있다고 생각하니? 여기 aspx URL을 사용하여 jQuery 자동 완성을 사용하는 방법은 무엇입니까?

$('[id$=txtEntry2]').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true }); 

가 .aspx 페이지입니다 그것은 문자열 목록 반환 한 두 가지 방법 호출 : 여기

은 (document.ready (기능) $를 jQuery를에 호출된다.

protected void Page_Init(object sender, EventArgs e) 
     { 
      //get the parameter from the query string, pass to fetch data 
      string whichSearch = Request.QueryString["type"]; 

      //FC = FeedCode, IC = Ing. Code 
      if (whichSearch == "FC") 
      { 
       List<string> feedCodes = SearchFeedCodes(); 
       foreach (string feedCode in feedCodes) 
       { 
        Response.Write(feedCode); 
       } 
      } 
      else //IC 
      { 
       List<string> ingCodes = SearchIngredientCodes(); 
       foreach (string ingCode in ingCodes) 
       { 
        Response.Write(ingCode); 
       } 
      } 
     } 

답변

0

자동 완성 jQuery 조각이 "q"를 찾고 있습니다. 고유 한 사용자 지정 식별자를 사용하고 있었으며 StringBuilder를 사용하여 줄별로 각 항목을 한 줄씩 작성해야했습니다.

관련 문제