ajax autocomplete-extender funktioniert nicht

Ich habe eine autocompleate extender auf die textbox zeigt Datensätze als Liste aus Datenbank, sondern whern ich auf texbox und beginnen Sie mit der Eingabe nichts happned. mein html-code ist

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
         Enabled="True"  TargetControlID="TextBox1" ServicePath="~/WebService.asmx" 
                ServiceMethod="GetCompletionList"
                MinimumPrefixLength="2" 
                CompletionInterval="1000"
                EnableCaching="true"
                CompletionSetCount="20"
                DelimiterCharacters=";, :"
                ShowOnlyCurrentWordInCompletionListItem="true" >
    </asp:AutoCompleteExtender>

Und meinem web-service ist

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Data;
    using MySql.Data.MySqlClient;
    using System.Configuration;

     ///<summary>
     ///Summary description for WebService
    ///</summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    //To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    //[System.Web.Script.Services.ScriptService]
     public class WebService : System.Web.Services.WebService {

    public WebService () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public static List<string> GetCompletionList(string prefixText, int count)
    {
        MySqlConnection con = new MySqlConnection(ConfigurationManager.AppSettings["cn"]);
        if (con.State == ConnectionState.Closed)
            con.Open();
        MySqlCommand cmd = new MySqlCommand("SELECT gotra FROM tbgotra WHERE gotra LIKE '%" + prefixText + "%'",con);
        List<string> k = new List<string>();
        using (MySqlDataReader sdr = cmd.ExecuteReader())
        {
            while (sdr.Read())
            {
                k.Add(sdr["gotra"].ToString());
            }
        }
        con.Close();
        return k;
    }
   }
Können Sie die Datenbank.asmx-code auch?
Ich rufe Liste der Objekte aus der Datenbank von meinem service-Methode. die ist oben angegeben.
IM sorry ich meine den Webservice.asmx-Datei, nur wollen, stellen Sie sicher, dass es richtig war.
ok, ich poste die ganze Datei

InformationsquelleAutor Vikas Rana | 2013-10-28

Schreibe einen Kommentar