ASP.NET - Autocomplete extender is not calling web method

Asked By sambit on 30-Nov-10 04:57 AM

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

                              <cc1:AutoCompleteExtender ID="AutoCompleteExtenderserch" runat="server" TargetControlID="TextBox1"
              ServiceMethod="GetCategory" MinimumPrefixLength="1"
                EnableCaching="true" CompletionSetCount="12" ServicePath="~/ProductProfiling/ManageProduct.asmx"
                              ContextKey="1">
              </cc1:AutoCompleteExtender>





This my web method


 public string[] GetCategory(string prefixText, int count)
    {
      string var = prefixText.ToString() + "%";
      List<string> items = new List<string>(count);
      //string[] companyName = new string[query.ToList().Count];
      //string str = "select Name,CategoryId from Category where Name like '" + var + "' and Level='0'";
      string str = " select Name, CategoryId from Category where Name like '" + var + "'";
      if (ObjCon.State != ConnectionState.Open)
      {
        ObjCon.Open();
      }

      ObjCmd = new SqlCommand(str, ObjCon);
      ObjDReader = ObjCmd.ExecuteReader();
      while (ObjDReader.Read())
      {
        items.Add(ObjDReader["Name"].ToString());
      }
      ObjDReader.Close();
      ObjCmd.Dispose();
      ObjCon.Close();
      return items.ToArray();

    }

Anoop S replied to sambit on 30-Nov-10 05:11 AM
In most cases where the WebService method does not get calls becasue the WebMethod Signature does not match with the AutoComplete Extender signature. The Method signature needs to be:

string[] WSMethodName(string prefixText, int count)

You can have different method name but the parameter names and return type needs to be exact match even in case.
div v replied to sambit on 30-Nov-10 05:20 AM
hi,,,

check out ur given Servicepath ...............................

ref this...