<asp:TextBox ID="txtName" runat="server" Height="18px" Width="366px" AutoPostBack="True" ></asp:TextBox> <ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="txtName" ServicePath="WebService1.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" />
[WebMethod, ScriptMethod] public static string[] GetCompletionList(string prefixText, int count) { if (count == 0) { count = 10; } if (prefixText.Equals("xyz")) { return new string[0]; } Random random = new Random(); List<string> items = new List<string>(count); for (int i = 0; i < count; i++) { char c1 = (char)random.Next(65, 90); char c2 = (char)random.Next(97, 122); char c3 = (char)random.Next(97, 122); items.Add(prefixText + c1 + c2 + c3); } return items.ToArray(); }
you Can check with attribute in web service [System.Web.Script.Services.ScriptService].Web Service to be called from script, using ASP.NET AJAX
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)