c# - Why is the AutoCompleteExtender firing the Page_Load event instead of the service method? -


Then I'm trying to implement the AutoCompleteExtender tool from AJAX Control Toolkit.

The following is the implementation of AutoCompleteExtender on my ASPX page:

   & Lt; Asp: RequiredFieldValidator runat = "server" ControlToValidate = "Customer Textbook" CssClass = "text-danger" ErrorMessage = "Customer area is required." Display = "none" /> & Lt; ajaxToolkit: AutoCompleteExtender id = "CustomerAutoCompleteExtender" runat = "server" TargetControlID = "CustomerTextBox" MinimumPrefixLength = "1" EnableCaching = "true" CompletionSetCount = "1" CompletionInterval = "1000" ServiceMethod = "GetAllCustomerNames" & gt; & Lt; / AjaxToolkit: AutoCompleteExtender & gt;   

The service system implemented in the code behind this file is:

  [System.Web.Services.WebMethod ()] [System.Web.Script .Services.ScriptMethod ()] Public Stabilized String [] GetAllCustomerNames (string prefix text, integer number) {list & lt; String & gt; AllCustomerNames = new list & lt; String & gt; (); & Lt; Customers & gt; All Customers = GetAllCustomers (); Forex Currency (Customer Clients In All Customers) {If (customer.CustomerName.Contains (prefix text)) {allCustomerNames.Add (customer.CustomerName); }} Return all the customer names. ToArray (); }   

The problem I am experiencing is that whenever I type a letter in the text box, the page's oops event will be ignored instead of the GetAllCustomerNames method Looks like someone can help me, where am I going wrong?

Additional information:

  • I am using Visual Studio 2013.
  • This is an ASP.NET web form that is running on .NET 4.5.
  • I have created a new project while using the default style and template, and such a master page is being used
  • ToolkitScriptManager in the master file Is specified and I have determined EnablePageMethods to true property.

    Try [System.Web.Services.WebMethod] WebMethod () and not next Remove the line.

    You set AutoPostBack = "true" on textbox, simply delete AutoPostBack or set it to false .

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -