Как использовать ajax auto complete extender в asp.net-что?
Я пытаюсь искать данные из базы данных, но не могу получить результат.Пожалуйста, может ли любое тело помочь мне.
спасибо заранее
<asp:TextBox ID="txtlicense" runat="server"></asp:TextBox> <ajax:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtlicense" MinimumPrefixLength="1" EnableCaching="true" ServicePath="WebService.asmx" ServiceMethod="GetLicense" CompletionInterval="100" CompletionSetCount="10" > </ajax:AutoCompleteExtender>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Configuration; using System.Data; using System.Data.SqlClient; /// <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 List<string> GetLicense(string prefixText) { SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=True;Initial Catalog=LicenseManagementSystem"); con.Open(); SqlCommand cmd = new SqlCommand("select LicenseNumber from LicenseDetails where LicenseNumber like @license+'%'", con); cmd.Parameters.AddWithValue("@license", prefixText); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); List<string> license = new List<string>(); for (int i = 0; i < dt.Rows.Count; i++) { license.Add(dt.Rows[i][1].ToString()); } return license; } }