AutoCompleteExtender doesn't work

Discussion in 'ASP .Net' started by rote, Jun 1, 2007.

  1. rote

    rote Guest

    I tried using the

    AutoCompleteExtender sample code below but it doesn't seem to work.
    I'm not using a ServicePath="GetCompletionList.asmx"
    But the textbox doesn't return anything either does it trigger
    Any ideas and thanks in advance

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:TextBox runat="server" ID="myTextBox" Width="300" autocomplete="off" />
    <ajaxToolkit:AutoCompleteExtender runat="server"
    ID="autoComplete1"
    TargetControlID="myTextBox"
    ServiceMethod="GetCompletionList"
    MinimumPrefixLength="1"
    CompletionInterval="1000"
    EnableCaching="true"
    CompletionSetCount="12" />
    </form>



    public partial class _Default : System.Web.UI.Page {
    [WebMethod]
    public static string[] GetCompletionList(string prefixText, int count) {
    string sql = String.Format("select companyName from customers where
    companyname like @companyname + '%'");

    List<string> companyList = new List<string>();
    using (SqlConnection connection = new SqlConnection("Integrated
    Security=SSPI;Initial Catalog=Northwind;Data Source=."))
    using (SqlCommand command = new SqlCommand(sql, connection)) {
    connection.Open();
    command.Parameters.AddWithValue("@companyname", prefixText);
    using (SqlDataReader reader = command.ExecuteReader()) {
    while (reader.Read()) {
    companyList.Add(reader.GetString(0));
    }
    }
    }

    return companyList.ToArray();
    }
    rote, Jun 1, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Appelmans

    Atlas AutoCompleteExtender not working...

    Michael Appelmans, Jun 27, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,226
    Michael Appelmans
    Jun 27, 2006
  2. Jay
    Replies:
    0
    Views:
    920
  3. ack95

    ASP.NET AJAX AutoCompleteExtender

    ack95, Jan 17, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    519
    ack95
    Jan 17, 2007
  4. rote
    Replies:
    1
    Views:
    429
    Bryan Porter
    Nov 29, 2007
  5. Shreya Trivedi
    Replies:
    0
    Views:
    632
    Shreya Trivedi
    Feb 15, 2010
Loading...

Share This Page