AJAX AutoCompleteExtender Not Working

Last post 09-04-2008 5:57 AM by Zhi-Qiang Ni - MSFT. 3 replies.

Sort Posts:

  • AJAX AutoCompleteExtender Not Working

    08-31-2008, 12:00 PM

    i have autocomplete extender as

    <asp:TextBox ID="txtCommodity" runat="server" CssClass="TextBox" AutoPostBack="true"></asp:TextBox>

    <ajaxToolkit:AutoCompleteExtender ID="autoComplete" runat="server" TargetControlID="txtCommodity"

    CompletionInterval="100" CompletionSetCount="20" EnableCaching="false" ServicePath="~/AutoCompleteList.asmx"

    MinimumPrefixLength="1" ServiceMethod="GetCompletionList" />

    in one of aspx.cs pages

    and my webservice is 

    [WebService(Namespace = "shwetha")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [ScriptService]

    public class AutoCompleteList : WebService

    {

    [
    WebMethod]public string[] GetCompletionList(string prefixText, int count, string contextKey)

    {

    string[] ret = new string[] { "A", "B", "C" };

    return ret;

    }

     

    }

    but this is not working ,wat could be probable soultion for it

    can anyone help me on this 

     

  • Re: AJAX AutoCompleteExtender Not Working

    08-31-2008, 12:36 PM
    • Star
      8,079 point Star
    • Ken Tucker
    • Member since 12-23-2003, 1:40 PM
    • Port St. John, Florida
    • Posts 1,216
    • TrustedFriends-MVPs

     Did you register the webservice with the scriptmanager?

  • Re: AJAX AutoCompleteExtender Not Working

    08-31-2008, 1:22 PM

    yes my master page has this

    <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">

    <Services>

    <asp:ServiceReference Path="~/AutoCompleteList.asmx" />

    </Services>

    </ajaxToolkit:ToolkitScriptManager>

  • Re: AJAX AutoCompleteExtender Not Working

    09-04-2008, 5:57 AM
    Answer

    Hi,

    I have tested your code locally to resolve this issue. What my thought is the format of the ServiceMethod is not correct.

    Please change it to this: 

            [System.Web.Services.WebMethod]
            [System.Web.Script.Services.ScriptMethod]
            public string[] GetCompletionList(string prefixText, int count)//, string contextKey
            {
                string[] ret = new string[] { "A", "B", "C" };
    
                return ret.ToArray();
            }
    You can refer the example page and the tutorial video for the using of the AutoCompleteExtender:

    http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx
    How Do I:Use the ASP.NET AJAX AutoComplete Control

    Have my suggestions helped?

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
Page 1 of 1 (4 items)