1
Answer

Auto Complete

arul

arul

15y
4.6k
1

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)