Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've seen numerous posts and tips on CP and elsewhere that show people having successfully implemented the AjaxControlToolkit auto-complete without a webservice but I just can't get the page method to fire.

I think I've tried every approach out there, but to no avail. My code, at present, looks like this:

.aspx:

XML
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true"  </asp:ToolkitScriptManager>


XML
<asp:TextBox runat="server" ID="tbMatterReference" />
        <asp:AutoCompleteExtender ID="tbMatterReference_AutoCompleteExtender"
            runat="server" DelimiterCharacters="" Enabled="True"
            ServiceMethod="GetCompletionList" CompletionInterval="0" CompletionSetCount="1" ServicePath=""
            TargetControlID="tbMatterReference" UseContextKey="True"></asp:AutoCompleteExtender>



aspx.cs:

XML
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
    MatterDetailsList matters = new MatterDetailsList();

    List<string> list = new List<string>();

    foreach (MatterDetails matter in matters.MatterDetails)
    {
        list.Add(matter.code);
    }

    return list.ToArray<string>();
}



There are no errors as such, it just doesn't do anything. Breakpoints in the code behind aren't hit and the TextBox just works as a vanilla TextBox.

I'm sure that I'm missing something blindingly obvious!
Posted
Updated 31-Dec-14 1:37am
v2

1 solution

I'm an idiot.

There was an exception being thrown by my code-behind method but this gets handled/suppressed by the extender. It would be nicer if the error was thrown but I really should have spotted it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900