arul

arul

  • NA
  • 26
  • 0

Auto Complete

Dec 14 2008 5:47 AM

Hi,
Sometimes my auto complete is working Sometimes not working. this is my code.what is problem ?

Code Behind
==========
 [WebMethod]
    public string[] GetCompletionList(string prefixText)
    {
        prefixText = prefixText.ToUpper().Trim();
        List<string> items = new List<string>();
        String sConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        OleDbConnection objDBConnection = new OleDbConnection(sConnectionString);
        objDBConnection.Open();
        String strSelect = "select ComputerName from Pc_System_Info  where UPPER(ComputerName) like '%" + prefixText + "%'";
        OleDbCommand objCmd = new OleDbCommand(strSelect, objDBConnection);
        OleDbDataReader dr = objCmd.ExecuteReader();
        while (dr.Read())
        {
            items.Add(dr["ComputerName"].ToString());
        }
        return items.ToArray();
    }

Design Time
============
<ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="autoComplete1"
TargetControlID="txtPCNAME" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList"
MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :">


Please let me know

Thanks and Regards
Arul.P


Answers (1)