Tags

,


Auto Complete with WebService in asp.net 3.5

WebService Classs File:
[WebService(Namespace = “http://tempuri.org/“)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]  //Class will Get called  by Script
public class DmsAutoComplete : Systam.Web.WebSarvices.WebService
{
    public DmsAutoComplete(){}

    [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public string[] GetNames(string prefixText, int count)
    {
        String[] names = {“Amit”,”Sumit”,”Rahul”};
        return names;
    }
}

ASPX Page:

 <asp:TextBox ID=”TextBox2″ runat=”server”></asp:TextBox>
   <cc1:AutoCompleteExtender
        ID=”AutoCompleteExtender1″ runat=”server”
        TargetControlID=”TextBox2″
        ServiceMethod=”GetNames”
        ServicePath=”~/WebServices/DmsAutoComplete.asmx”
        MinimumPrefixLength=”2″
        CompletionInterval=”100″
        EnableCaching=”true” UseContextKey=”false”
     />

 

Enjoy!

Advertisements