Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text box:
ASP
<div>    
  <asp:TextBox ID="TextBox1" runat="server" Height="19px" Width="249px">
  <asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
            DelimiterCharacters="" Enabled="True" MinimumPrefixLength="1" ScriptPath="" 
            ServiceMethod="findName" ServicePath="WebService.asmx" 
            TargetControlID="TextBox1">        
  <br />
  <asp:ScriptManager ID="ScriptManager1" runat="server">
</div>


I have a WebService:

[WebMethod]
C#
public string[] findName(string prefix)
{
    SqlConnection cn = new SqlConnection("uid=sa;pwd=tatwa;server=192.168.10.19;database=DAMBanking");
    cn.Open();
    string query = "select * from T_Advisor_Master where Advisor_Name like '" + prefix + "%'";
    SqlDataAdapter da = new SqlDataAdapter(query, cn);
    DataSet ds = new DataSet();
    ds.Clear();
    ds.Reset();
    da.Fill(ds);
    string[] item = new string[ds.Tables[0].Rows.Count];
    int i = 0;
    foreach (DataRow dr in ds.Tables[0].Rows)
    {
        item.SetValue(dr["Advisor_Name"].ToString(), i);
        i++;
    }
    return item;
}


But when I click on the textbox it is not fetching the data,
But when I run the WebService file the data is showing in xml format.
But I need it show when I click on textbox like a list.
I am using .net2010
It is working in .net2008 but not in 2010

Please help me!
Posted
Updated 8-Nov-11 19:45pm
v2

 
Share this answer
 
 
Share this answer
 
v2
Check my answer here
Drop down for search textbox[^]
 
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