Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all..

I am writing a web service in using ajax autocomplete extender.but all in vain.I am fade up with the thing going on.i am trying for two days but nothing works with jquery and ajax.
my code is:
ON aspx page:

XML
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
  <Services>
  <asp:ServiceReference  Path="~/WebService1.asmx" />
  </Services>
        </asp:ScriptManager>



XML
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
         <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetUsers"      ServicePath="~/WebService1.asmx"      TargetControlID="TextBox1" EnableCaching="true" CompletionInterval="10" />


My web service code.

MSIL
[WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [ToolboxItem(false)]
  // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
  [System.Web.Script.Services.ScriptService]
  public class WebService1 : System.Web.Services.WebService
  {
      [WebMethod]
      public List<string> GetUsers(string prefixText, int count)
      {
          WebSolution.DAL.databaseDataContext DC = new WebSolution.DAL.databaseDataContext();
          var Customers = from p in DC.users
                          where p.firstName.Contains(prefixText)
                          select p.firstName;
          return Customers.ToList();
      }
  }



I am able to invoke the web service methods and find record in browser.
please tell me.shld i have to change the web.config for something.or anything else .any reply will be honored.U can suggest me soultion using jquery.


Regards
Posted

1 solution

Here is on way that works:
WCF Data Services and jQuery[^]

Regards
Espen Harlinn
 
Share this answer
 

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



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