Hi dude i am facing a little problem.When i first time implemented auto complete suggestion it work properly but now after one month i use many other field to extend them as auto suggestion all of them are working but give suggestion in a single line.Please any one give me a solution.Thanks in advance.

<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>

 <ajaxToolkit:AutoCompleteExtender ID="autocomplete" runat="server" TargetControlID="txtsupgname"
                    ServicePath="autoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="2" 
                    CompletionInterval="100" EnableCaching="true" CompletionSetCount="20"      
                    ShowOnlyCurrentWordInCompletionListItem="true" >

<asp:TextBox ID="txtsupgname"  runat="server" Width="185px" TabIndex="1" 
                            ForeColor="Black" MaxLength="40"></asp:TextBox>

public class autoComplete : System.Web.Services.WebService 

    public string[] GetCompletionList(string prefixText, int count)
        using (SqlConnection cn = ConnectionManager.GetConnection())
            using (SqlCommand cmd = new SqlCommand("SELECT * FROM SupplierGroupSetup WHERE supg_name LIKE '%" + prefixText + "%'", cn))
                cmd.CommandType = CommandType.Text;
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);


                catch { }

                dt = ds.Tables[0];
                List<string> txtItems = new List<string>();
                string dbValues;

                foreach (DataRow row in dt.Rows)
                    dbValues = row["supg_name"].ToString();
                    dbValues = dbValues.ToLower();
                return txtItems.ToArray();

Member Avatar

Can you provide a screenshot so that we can better understand your problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.