function SearchText() { $('#<%= txtusername.ClientID%>').autocomplete({ source: function (request, response) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "../HttpHandler/Autocomplete.asmx/GetCallername", data: "{'callerid':'" +9999999999+ "'}", dataType: "json", success: function (data) { response(data.d); alert('i enter'); }, error: function (result) { alert("Error"); } }); } }); }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using MSDataAccess; using System.Data; namespace Sun.HttpHandler { /// <summary> /// Summary description for Autocomplete /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 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 Autocomplete : System.Web.Services.WebService { [WebMethod] public string GetCallername(string callerid) { ConnectionCls clsConObj = new ConnectionCls(); DataSet ds = null; string strPriorityOfCall = null; object[] obj = new object[6]; obj[0] = 1; obj[1] = 1; obj[2] = 1; obj[3] = 1; obj[4] = 1; obj[5] = callerid; ds = DataAccess.ExecuteDataset(clsConObj.getConnectionString(), "sp_autoload", obj); if (ds.Tables[0].Rows[0]["CallerName"].ToString() != System.DBNull.Value.ToString()) { return ds.Tables[0].Rows[0]["CallerName"].ToString(); } else { return "User Doesnt Exist"; } } } }
data: "{'callerid':'9999999999'}",
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)