Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am using autocomplete extender in my application.the control doesnt giving the values in textbox.And i am using webservice to get the values.

this my web method code and design code

C#
[WebMethod]
    public List<string> GetNames(string prefixText)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from familytwo where Name like @Name+'%'", con);
        cmd.Parameters.AddWithValue("@Name", prefixText);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        List<string> Names = new List<string>();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Names.Add(dt.Rows[i][1].ToString());
        }
        return Names;
    }

html code:

ASP.NET
<asp:TextBox ID="TextBox2"  runat="server" Width="244px">
                     <ajax:AutoCompleteExtender ID="AutoCompleteExtender"  runat="server" TargetControlID="TextBox2" ServiceMethod="GetNames"
                     ServicePath="~/autocompleteasmx.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionInterval="1000" CompletionSetCount="1">

whats the issue in that..
can anyone help me to solve this?
Posted
Updated 8-Mar-12 18:31pm
v2

Using WCFTestClient, validate the functionality of GetNames method whether it returns the value or not.
 
Share this answer
 
Comments
Thendral.N 9-Mar-12 0:45am    
it will return the values..
Thendral.N 9-Mar-12 0:47am    
i am using web service.while iam checking through webservice it will return the values in xml like
<arrayofstring>
<string>Dental
<string>Diabetes
<string>DNA
<string>Dementia
<string>Dorsal
There are two other properties missing in AutoCompleteExtender. They are:

HTML
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true"
 
Share this answer
 
Comments
Thendral.N 9-Mar-12 0:49am    
i gave this two lines but i wont work.whether i need to give any coding in my code behind page?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900