<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"> <Services> <asp:ServiceReference Path="~/WebService1.asmx" /> </Services> </asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetUsers" ServicePath="~/WebService1.asmx" TargetControlID="TextBox1" EnableCaching="true" CompletionInterval="10" />
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [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 WebService1 : System.Web.Services.WebService { [WebMethod] public List<string> GetUsers(string prefixText, int count) { WebSolution.DAL.databaseDataContext DC = new WebSolution.DAL.databaseDataContext(); var Customers = from p in DC.users where p.firstName.Contains(prefixText) select p.firstName; return Customers.ToList(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)